質問: array( 'labels' => $labels, 'hierarchical' => true, 'description' => 'image galleries for teachers classes', 'supports' => array( 'title', 'editor', 'author'), 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_icon' => get_bloginfo('template_url') . '/images/imagegallery.png', 'show_in_nav_menus' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'has_archive' => true, 'query_var' => true, 'can_export' => true, 'rewrite' => true, 'capability_type' => 'post', 'capabilities' => array( 'edit_post' => 'edit_gallery', 'edit_posts' => 'edit_galleries', 'edit_others_posts' => 'edit_other_galleries', 'publish_posts' => 'publish_galleries', 'read_post' => 'read_gallery', 'read_private_posts' => 'read_private_galleries', 'delete_post' => 'delete_gallery' ) ); register_post_type( 'gallery', $args ); } 私はまたこれを完全に新しいカスタム投稿タイプでテストしました、そしてそれを削除して私のカスタム投稿を追加したとしても、私は同じ問題を得ます。'capability_type' => array('movie','movies');
回答: magicroundabout との簡単なチャットの後で justin tadlock から有用なリソースを指摘したところ、役割にadd_capを使用しない限り、カスタム投稿タイプの機能は実際には存在しません。たとえば、次のカスタム投稿タイプの場合add_action( 'init', 'register_cpt_gallery' ); function register_cpt_gallery() { $labels = array( 'name' => _x( 'galleries', 'gallery' ), 'singular_name' => _x( 'gallery', 'gallery' ), 'add_new' => _x( 'add new', 'gallery' ), 'add_new_item' => _x( 'add new gallery', 'gallery' ), 'edit_item' => _x( 'edit gallery', 'gallery' ), 'new_item' => _x( 'new gallery', 'gallery' ), 'view_item' => _x( 'view gallery', 'gallery' ), 'search_items' => _x( 'search galleries', 'gallery' ), 'not_found' => _x( 'no galleries found', 'gallery' ), 'not_found_in_trash' => _x( 'no galleries found in trash', 'gallery' ), 'parent_item_colon' => _x( 'parent gallery:', 'gallery' ), 'menu_name' => _x( 'galleries', 'gallery' ), ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'description' => 'image galleries for teachers classes', 'supports' => array( 'title', 'editor', 'author'), 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_icon' => get_bloginfo('template_url') . '/images/imagegallery.png', 'show_in_nav_menus' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'has_archive' => true, 'query_var' => true, 'can_export' => true, 'rewrite' => true, 'capabilities' => array( 'edit_post' => 'edit_gallery', 'edit_posts' => 'edit_galleries', 'edit_others_posts' => 'edit_other_galleries', 'publish_posts' => 'publish_galleries', 'read_post' => 'read_gallery', 'read_private_posts' => 'read_private_galleries', 'delete_post' => 'delete_gallery' ), // as pointed out by iemanuele, adding map_meta_cap will map the meta correctly 'map_meta_cap' => true ); register_post_type( 'gallery', $args ); } 「管理者」を含め、バックエンドで実際に機能するためのパーミッションのロールに追加機能を追加する必要があります。function add_theme_caps() { // gets the administrator role $admins = get_role( 'administrator' ); $admins->add_cap( 'edit_gallery' ); $admins->add_cap( 'edit_galleries' ); $admins->add_cap( 'edit_other_galleries' ); $admins->add_cap( 'publish_galleries' ); $admins->add_cap( 'read_gallery' ); $admins->add_cap( 'read_private_galleries' ); $admins->add_cap( 'delete_gallery' ); } add_action( 'admin_init', 'add_theme_caps'); これが他の人に役立つことを願っています。