我正在为一个项目创建一个插件,该插件有一个名为“listing”的自定义分类,这是我注册的方式:
add_action('init', function(){
register_taxonomy( 'listings', 'listings', array(
'hierarchical' => true,
'show_ui' => true,
'query_var' => true,
'labels' => array(
'name' => _x( 'Listings', 'taxonomy general name' ),
'singular_name' => _x( 'Listings', 'taxonomy singular name' ),
'search_items' => __( 'Search Listings' ),
'all_items' => __( 'All Listings' ),
'parent_item' => __( 'Parent Listings' ),
'parent_item_colon' => __( 'Parent Listings:' ),
'edit_item' => __( 'Edit Listings' ),
'update_item' => __( 'Update Listings' ),
'add_new_item' => __( 'Add New Listings' ),
'new_item_name' => __( 'New Listings Name' ),
'menu_name' => __( 'Listings Categories' ),
),
'rewrite' => array(
'slug' => 'listings',
'with_front' => true
)
));
});
当我尝试访问网址“http://myprojecturl/listings/some-category
”时,出现404错误。发生了什么?我是wordpress的新手。