I have created a custom post type named “Project” for my website. I added custom capabilities using this line in the register_post_type call:
'capability_type' => 'project',
This gives me the set of capabilities using standard, default names:
edit_project, read_project, publish_project, and so on.
I wanted to add a user role that can only edit the projects post type and nothing else. So I created a new role like this:
add_role( 'project_editor', 'Project Editor', array( 'read' => true, 'edit_projects' => true, 'edit_project' => true, 'read_project' => true, 'delete_project' => true, 'edit_others_projects' => true, 'publish_projects' => true, 'upload-files' => true, ) );
So far, so good. I created a user, assigned the Project Editor role, and the new user can edit projects as I needed.
However, now my administrator account can no longer edit the projects.
So my question is, is there a way to set this up so that users can edit the projects with either edit_project or edit_post capabilities, or do I need to add the individual project capabilities to all user roles?
- The topic ‘Making sense of custom post types and capabilities’ is closed to new replies.