3

I have a WP site with a custom role (revisor) and a custom post type (events).

What I would like to do is allow my revisors to add new events, but not edit existing.

I'm already using the Members plugin, and i have 'edit_published_events' unchecked in it, but the users can still edit the events.

I think the problem is that I have another CPT that I want to let them edit (called listings), so I can't fully restrict 'edit_posts' in the capabilities.

Any ideas on how I can just remove the option for editing a published CPT? I did see a post about removing the 'edit' option that appears when you hover over the post's name in the list, but clicking on the post still lets you edit...

Thanks!!!

3
  • Do you have the code you used to create the revisor role? Feb 4, 2014 at 22:01
  • @BradDalton It is created via a plugin called Revisionary Plus, which makes a role that can't publish directly but has to be approved first, so I never created the role myself.
    – Aaron
    Feb 5, 2014 at 2:41
  • You could simply use the native Contributor role or create your own using code which is very easy. More flexible this way for customization. wordpress.stackexchange.com/a/129534/9884 Feb 5, 2014 at 7:10

1 Answer 1

1

Something like this (untested)

add_action( 'init', 'remove_revisor_cap_edit_posts' ); 

function remove_revisor_cap_edit_posts() {

if ( 'events' == get_post_type() ) {

$role = get_role( 'revisor' );
$role->remove_cap( 'edit_posts' );
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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