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
Wordpress 自定义类别元数据库不起作用_Wordpress_Custom Post Type_Taxonomy - Fatal编程技术网

Wordpress 自定义类别元数据库不起作用

Wordpress 自定义类别元数据库不起作用,wordpress,custom-post-type,taxonomy,Wordpress,Custom Post Type,Taxonomy,我在function.php中添加了一些自定义帖子类型和自定义分类法,它们非常有效。我为自定义帖子类型分配了一些层次和非层次分类法(catagories&tags right?)。非层次分类法工作得很好,我可以在编辑文章时在标记元框中添加新项。但是,这不适用于我的层次分类法!我不知道错误在哪里,但是“添加新车辆类别”和“最常用”按钮不起作用添加所有,您可以单击它们,但不加载任何内容。这与javascript有关吗? 以下是我注册的自定义帖子类型之一: $labels = array(

我在function.php中添加了一些自定义帖子类型和自定义分类法,它们非常有效。我为自定义帖子类型分配了一些层次和非层次分类法(catagories&tags right?)。非层次分类法工作得很好,我可以在编辑文章时在标记元框中添加新项。但是,这不适用于我的层次分类法!我不知道错误在哪里,但是“添加新车辆类别”和“最常用”按钮不起作用添加所有,您可以单击它们,但不加载任何内容。这与javascript有关吗? 以下是我注册的自定义帖子类型之一:

$labels = array(
        'name'                  => _x( 'Finished Projects', 'post type general name' ),
        'singular_name'         => _x( 'Finished Project', 'post type singular name' ),
        'menu_name'             => _x( 'Finished Projects', 'admin menu' ),
        'name_admin_bar'        => _x( 'Finished Project', 'add new on admin bar' ),
        'add_new'               => _x( 'Add New', 'Finished Project' ),
        'add_new_item'          => __( 'Add New Finished Project' ),
        'new_item'              => __( 'New Finished Project' ),
        'edit_item'             => __( 'Edit Finished Project' ),
        'view_item'             => __( 'View Finished Project' ),
        'all_items'             => __( 'All Finished Projects' ),
        'search_items'          => __( 'Search Finished Projects' ),
        'parent_item_colon'     => __( 'Parent Finished Projects:' ),
        'not_found'             => __( 'No Finished Projects found.' ),
        'not_found_in_trash'    => __( 'No Finished Projects found in Trash.' )
    );

    $args = array(
        'labels'                => $labels,
        'description'           => 'Page template for Finished Projects',
        'public'                => true,
        'publicly_queryable'    => true,
        'show_ui'               => true,
        'show_in_menu'          => true,
        'query_var'             => true,
        'rewrite'               => array( 'slug' => 'finished_projects' ),
        'capability_type'       => 'post',
        'has_archive'           => true,
        'hierarchical'          => false,
        'menu_position'         => null,
        'supports'              => array('excerpt','comments','author'),
        'taxonomies'            => array('scales', 'manufacturers','product categories','vehicle categories','countries'),
    );

    register_post_type( 'finishedprojects', $args );
下面是我注册的自定义分类法之一:

//Vehicle Categories
    $labels = array(
        'name'              => _x( 'Vehicles Categories', 'taxonomy general name' ),
        'singular_name'     => _x( 'Vehicle Category', 'taxonomy singular name' ),
        'search_items'      => __( 'Search Vehicles Categories' ),
        'all_items'         => __( 'All Vehicles Categories' ),
        'parent_item'       => __( 'Parent Vehicle Category' ),
        'parent_item_colon' => __( 'Parent Vehicle Category:' ),
        'edit_item'         => __( 'Edit Vehicle Category' ),
        'update_item'       => __( 'Update Vehicle Category' ),
        'add_new_item'      => __( 'Add New Vehicle Category' ),
        'new_item_name'     => __( 'New Vehicle Category Name' ),
        'menu_name'         => __( 'Vehicle Categories' ),
    );

    $args = array( 
        'hierarchical'      => true,
        'labels'            => $labels,
        'show_ui'           => true,
        'show_admin_column' => true,
        'query_var'         => true,
        'rewrite'           => array( 'slug' => 'vehicle_categories' ), 
    );
    register_taxonomy( 'vehicle category', array( 'reviews','finishedprojects' ), $args );
你们需要更多的信息还是这些信息足够


谢谢

从分类名称中删除空格

为此,请更换:

register_taxonomy( 'vehicle category', array( 'reviews','finishedprojects' ), $args );
'taxonomies'  => array('scales', 'manufacturers','product categories','vehicle categories','countries'),
与:

此外,替换:

register_taxonomy( 'vehicle category', array( 'reviews','finishedprojects' ), $args );
'taxonomies'  => array('scales', 'manufacturers','product categories','vehicle categories','countries'),
与:


我在分类名称中看到空格。试着用下划线替换这些。谢谢!我犯了愚蠢的错误!