My wordpress theme has a custom post-type. Only editors (and higher) should be allowed to use this post type.
I did this with:
function add_capability($role,$cap) {
$role_obj = get_role($role); // get the the role object
$role_obj -> add_cap($cap); // add $cap capability to this role object
}
function set_cpt() {
add_capability('editor', 'edit_cpt');
add_capability('editor', 'read_cpt');
add_capability('editor', 'delete_cpt');
add_capability('editor', 'edit_cpt');
add_capability('editor', 'edit_cpt');
add_capability('editor', 'publish_cpt');
add_capability('editor', 'read_cpt');
}
add_action('init', 'set_cpt');
(I think) in WordPress 3.1 this was enough – all editors and higher had the right to use the post-type.
Now, in WordPress 3.2 only editors have the right to use the post-type.
Is there a way to grant privileges to role X and higher or would I have to mention every role?
Thank you!
[edit]
actually I found out that this never worked before. But is there another way to do it?