2014-10-04 126 views
1

我真的很感谢这里的一些帮助。我已经创建了自定义的帖子类型和映射功能。自定义帖子类型显示在管理面板中,但我无法添加新帖子。当我删除功能=> $功能并将其更改为capability_type =>'后'时,它开始工作。自定义帖子类型的功能

// 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', 

);

​​

);

$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') 
); 

我想我已经犯了一个简单的错误,但我无法弄清楚。请有人看看代码,让我知道我做错了什么,请问?我正在这里拉我的头发。

回答

0

为自定义帖子类型添加新功能不够。您必须向内建角色或特定用户添加相同的功能,或者使用新功能创建新角色。您可以在Codex User_and_Author_Functions中阅读更多信息。

+0

我意识到这一点。我已安装用户角色编辑器,注册了所有功能,并将其与用户关联。但是,管理员是否也应该自动获取所有功能的默认访问权限? – Ollie 2014-10-04 09:23:04