1

If I create a custom post type and want to create custom capabilities for that, how do I do this? For example, I want to let my Editors to edit and create and delete posts and pages, but not the custom post type I've created? I also want to have the possibility to change the capabilities later with this plugin: http://wordpress.org/extend/plugins/user-role-editor/ (see the screens of the available capabilities: http://wordpress.org/extend/plugins/user-role-editor/screenshots/) I've done this by now this way:

global $wp_roles;

if(!isset($wp_roles)) {
    $wp_roles = new WP_Roles();
}

// add capability $cap to role $role
$roles = $wp_roles->get_names();
$wp_roles->add_cap('administrator', 'organize_matches');

But then even I as administrator am not able to save the custom post type (and yeah, I mentioned 'organize_matches' in the 'capabilities' argument when registering the custom post type). Really appreciate Your help!

1

Use 'capability_type' & 'capabilities' when you register_post_type().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.