1

我正在开发 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);
4

0 回答 0