Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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