无法访问自定义帖子类型的标签?

时间:2019-02-25 15:46:29

标签: php wordpress tags custom-post-type access-denied

我创建了一个名为"blogs"的自定义帖子类型。

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

    $args = array(
        'labels'             => $labels,
        'description'        => __( 'Description.', 'your-plugin-textdomain' ),
        'public'             => true,
        'publicly_queryable' => true,
        'show_ui'            => true,
        'show_in_menu'       => true,
        'query_var'          => true,
        'rewrite'            => array( 'slug' => 'blogs','with_front' => false),
        'capability_type'    => 'post',
        'taxonomies' => array('blog', 'post_tag') , 
        'has_archive'        => true,
        'hierarchical'       => true,
        'menu_position'      => 'dashicons-portfolio',
        'supports'           => array( 'title', 'post-formats', 'editor', 'excerpt', 'thumbnail', 'comments', 'custom-fields', 'revisions','author'),
    );

    register_post_type( 'blogs', $args );

然后我已经注册了分类法

register_taxonomy(
        'blog',
        'blogs',
        array(
            'label' => __( 'Blogs Category' ),
            'rewrite' => array( 'slug' => 'blog' ),         
            'hierarchical' => true,
            'show_admin_column' => true,
            'show_ui' => true,
            'show_tagcloud' => true,

        )
    );

它在管理面板中显示为:

enter image description here

当我单击“标签”链接时,它显示一条消息“访问被拒绝”

enter image description here

`edit-tags.php?taxonomy=post_tag&post_type=blogs` is not accessable.

我在哪里犯错?

0 个答案:

没有答案