我正在开发WordPress主题,我无法弄清楚为什么我不能为现有自定义角色添加新的自定义功能而不使用任何用户插件
//Function for creating new custom capability
function map_custom_cap($roles = array()){
foreach ( $roles as $role => $cap ) {
$role->add_cap($cap);
}
}
//This capabilities are not yet existing
$reviewer_cap = array( 'read', 'edit_posts', 'delete_posts');
$movie_author_cap = array( 'read_movie', 'edit_movies', 'delete_movies');
$roles = array(
'reviewer' => $reviewer_cap,
'movie_author' => $movie_author_cap
);
map_custom_cap($roles);