我创建了一个名为"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,
)
);
它在管理面板中显示为:
当我单击“标签”链接时,它显示一条消息“访问被拒绝”
`edit-tags.php?taxonomy=post_tag&post_type=blogs` is not accessable.
我在哪里犯错?