我已在以下网站注册了帖子类型--
$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);
当我发布新假日或开始编辑现有假日时,我想删除标题下方显示的永久链接。
我想删除它,因为假期将显示在单独的小部件中。我不希望管理员能够看到它作为一个单一的职位无论如何。没有为此类定义模板。
最合适的回答,由SO网友:Krzysiek Dróżdż 整理而成
嗯,还有另一种方法。我想更好。
你应该看看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
如果post类型不是public,那么您将看不到编辑器的这一部分。