0

我正在为一个项目创建一个插件,该插件有一个名为“列表”的自定义分类,这是我注册它的方式:

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
        )
    )); 
});

当我尝试访问 URL“ http://myprojecturl/listings/some-category”时,我收到 404 错误。发生了什么?我对wordpress真的很陌生。

4

0 回答 0