我正在使用wordpress自定义贴子和register\\u分类,下面是我的代码。
function epg_works_register() {
$labels = array(
\'name\' => __(\'Works\'),
\'singular_name\' => __(\'Works\'),
\'add_new\' => __(\'Add Works Item\'),
\'add_new_item\' => __(\'Add New Works Item\'),
\'edit_item\' => __(\'Edit Works Item\'),
\'new_item\' => __(\'New Works Item\'),
\'view_item\' => __(\'View Works Item\'),
\'search_items\' => __(\'Search Works Item\'),
\'not_found\' => __(\'No Works Items found\'),
\'not_found_in_trash\' => __(\'No Works Items found in Trash\'),
\'parent_item_colon\' => \'\',
\'menu_name\' => __(\'Works\')
);
// Set other options for Custom Post Type
$args = array(
\'labels\' => $labels,
// Features this CPT supports in Post Editor
\'supports\' => array( \'title\', \'editor\'),
/* A hierarchical CPT is like Pages and can have
* Parent and child items. A non-hierarchical CPT
* is like Posts.
*/
\'hierarchical\' => true,
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'show_in_nav_menus\' => true,
\'menu_position\' => 5,
\'can_export\' => true,
\'has_archive\' => true,
\'exclude_from_search\' => true,
\'publicly_queryable\' => true,
\'capability_type\' => \'post\',
);
// Registering your Custom Post Type
register_post_type( \'works\', $args );
register_taxonomy(\'works_category\', \'works\', array(\'hierarchical\' => true, \'label\' => \'Works Category\', \'query_var\' => true, \'rewrite\' => array(\'slug\' => \'works-categorys\')));
flush_rewrite_rules();
}
add_action( \'init\', \'epg_works_register\');
如果我将register\\u taxonomy(\'works\\u category\'更改为register\\u taxonomy(\'something\'),则会显示
http://localhost/wp-admin/nav-menus.php 但是如果使用register\\u分类法(“works\\u category”),那么我在那里看不到任何东西http://localhost/wp-admin/nav-menus.php.
怎么了?
谢谢