1 回答
TA贡献1829条经验 获得超6个赞
尝试在 functions.php 文件中为该新角色分配功能:
function add_role_caps() {
//roles to add capabilities
$roles = array('YOUR-NEW-ROLE','editor','administrator');
//set capabilities for selected roles
foreach($roles as $role) {
$myrole = get_role($role);
$myrole->add_cap( 'read' );
$myrole->add_cap( 'read_MYCPT');
$myrole->add_cap( 'read_private_MYCPTS' );
$myrole->add_cap( 'edit_MYCPT' );
$myrole->add_cap( 'edit_MYCPTS' );
$myrole->add_cap( 'edit_others_MYCPTS' );
$myrole->add_cap( 'edit_published_MYCPTS' );
$myrole->add_cap( 'publish_MYCPTS' );
$myrole->add_cap( 'delete_others_MYCPTS' );
$myrole->add_cap( 'delete_private_MYCPTS' );
$myrole->add_cap( 'delete_published_MYCPTS' );
}
}
add_action('admin_init','add_role_caps',999);
只需将 CAPS 值替换为您自己的值。此答案假定 CPT 是使用自定义帖子类型的可选复数描述性名称创建的。
- 1 回答
- 0 关注
- 107 浏览
添加回答
举报