我真的很感激这里的一些帮助。我创建了自定义帖子类型和映射功能。自定义帖子类型显示在管理面板中,但我无法添加新帖子。当我删除 capabilities=> $capabilities 并将其更改为 capability_type => 'post' 时,它开始工作。
// Human Sciences posts
$capabilities = array(
'publish_posts' => 'publish_human',
'edit_posts' => 'edit_humans',
'edit_others_posts' => 'edit_others_human',
'delete_posts' => 'delete_human',
'delete_others_posts' => 'delete_others_human',
'read_private_posts' => 'read_private_human',
'edit_post' => 'edit_human',
'delete_post' => 'delete_human',
'read_post' => 'read_human',
);
$labels = array(
'name' => 'Human Sciences Post',
'singular_name' => 'Post',
'menu_name' => 'Human Sciences Posts',
'name_admin_bar' => 'Human Sciences',
'add_new' => 'Add New',
'add_new_item' => 'Add New Post',
'new_item' => 'New Human Sciences Post',
'edit_item' => 'Edit Post',
'view_item' => 'View Posts',
'all_items' => 'All Human Sciences Posts',
'search_items' => 'Search Human Sciences Posts',
'parent_item_colon' => 'Parent Posts',
'not_found' => 'No Post Found',
'not_found_in_trash' => 'No Post Found in Trash',
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 6,
'menu_icon' => 'dashicons-visibility',
'query_var' => true,
'rewrite' => array( 'slug' => 'human-science' ),
'capabilities' => $capabilities,
'has_archive' => true,
'hierarchical' => true,
'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'post_formats' ),
'taxonomies' => array( 'category', 'post_tag')
);
我想我犯了一个简单的错误,但我无法弄清楚。有人可以看看代码,让我知道我做错了什么吗?我在这里拉头发。