Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress插件分类URL 404错误_Wordpress_Http Status Code 404_Taxonomy - Fatal编程技术网

Wordpress插件分类URL 404错误

Wordpress插件分类URL 404错误,wordpress,http-status-code-404,taxonomy,Wordpress,Http Status Code 404,Taxonomy,我正在为一个项目创建一个插件,该插件有一个名为“listings”的自定义分类法,下面是我注册它的方式: add_action('init', function(){ register_taxonomy( 'listings', 'listings', array( 'hierarchical' => true, 'show_ui' => true, 'query_var' => true, 'labels' =&

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

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真的很陌生。

您是否将它包装在函数中并使用
init
添加到
操作中??我假设您创建了一个名为
listings
的自定义帖子类型,该类型有效吗?@DavidChase是的,我有<代码>注册后类型('listings',$args)你是说你注册了两次分类法??首先我创建了插件,然后我注册了一个新的帖子类型显示在仪表板上,然后我创建了一个新的分类法。这是错误的吗?从上面的外观来看,似乎您对同一数据使用了两次
register\u taxonomy
?还是不?