考虑一下创建自定义文章类型的时候是否没有写:
‘map_meta_cap’ => true, ?
示例代码段如下:
<?php add_action('init', 'flam_Blog'); function flam_Blog() { $labels = array( 'name' => 'Blog Post', 'singular_name' => 'Blog Post', 'menu_name' => 'Blog Post', 'name_admin_bar' => 'Blog Post', 'add_new' => 'Add Blog Post', 'add_new_item' => 'Add New Blog Post', 'new_item' => 'New Blog Post', 'edit_item' => 'Edit Blog Post', 'view_item' => 'View Blog Post', 'all_items' => 'All Blog Post', 'search_items' => 'Search Blog Post', 'parent_item_colon' => 'Parent Blog Post', 'not_found' => 'No Blog Post found', 'not_found_in_trash' => 'No Blog Post found in trash', ); $args = array( 'labels' => $labels, 'description' => 'Blog Post', 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => array('slug' => 'blog'), 'capability_type' => array('blog','blogs'), 'has_archive' => true, 'show_in_rest' => true, 'hierarchical' => true, 'menu_position' => 5, 'supports' => array('title', 'editor', 'thumbnail'), 'map_meta_cap' => true, ); register_post_type('blog', $args); register_taxonomy('blog-tax', 'blog', array( 'label' => __('Blog Category'), 'rewrite' => array('slug' => 'blog-tax'), 'hierarchical' => true, 'show_in_rest' => true, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'map_meta_cap' => true, ) ); }
评论区
发表新的留言
您可以留言提出您的疑问或建议。
您的留言得到回复时,会通过您填写的邮箱提醒您。