問題描述
我已經註冊了以下的帖子類型 –
$holidayLabels = array(
'name' => __( 'Holidays'),
'singular_name' => __( 'Holidays'),
'all_items' => __( 'All Holidays'),
'add_new' => __( 'Add New Holiday'),
'add_new_item' => __( 'Add New Holiday'),
'edit_item' => __( 'Edit Holiday'),
'new_item' => __( 'New Holiday'),
'view_item' => __( 'View Holidays'),
'not_found' => __( 'No Holidays found'),
'not_found_in_trash' => __( 'No Holidays found in Trash'),
'parent_item_colon' => ''
);
$holidayArgs = array(
'labels' => $holidayLabels,
'public' => true,
'publicly_queryable' => true,
'_builtin' => false,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( "slug" => "holidays" ),
'capability_type' => 'post',
'hierarchical' => false,
//'menu_position' => 6,
'supports' => array( 'title'),
'has_archive' => false,
'show_in_nav_menus' => false,
);
register_post_type('holidays', $holidayArgs);
當我發佈新假期或開始編輯現有的假期時,我想刪除標題下方的固定鏈接。
我想刪除這個,因為假期將顯示在單獨的窗口小工具中。我不希望管理員能夠看到它作為單一的帖子無論如何。沒有為此定義模板。
最佳解決方案
那還有另一種方法。更好,我猜。
你應該看看 register_post_type 參數。你應該這樣設置它們:
'public' => false, // it's not public, it shouldn't have it's own permalink, and so on
'publicly_queryable' => true, // you should be able to query it
'show_ui' => true, // you should be able to edit it in wp-admin
'exclude_from_search' => true, // you should exclude it from search results
'show_in_nav_menus' => false, // you shouldn't be able to add it to menus
'has_archive' => false, // it shouldn't have archive page
'rewrite' => false, // it shouldn't have rewrite rules
如果帖子類型不是公開的,那麼你將看不到這部分編輯器。
參考文獻
注:本文內容整合自 Google/Baidu/Bing 輔助翻譯的英文資料結果。如果您對結果不滿意,可以加入我們改善翻譯效果:薇曉朵技術論壇。
