1

I have some custom user roles for proofreaders which do not have the capability to create posts of my custom post types.

Unfortunately I am unable to find out how to remove that capability for the bulit-in post post type.

The Members plugin does not show the create_post argument, so I can't set it do deny (false).

Thanks for your help.

2
  • Do you want to prevent them editing existing posts and deleting posts too? Oct 3, 2016 at 10:54
  • @AndyMacaulay-Brook They should be able to edit them (correct errors), but they should not be able to delete them, yes!
    – Sam
    Oct 3, 2016 at 11:21

1 Answer 1

0

There is no built-in capability of create_post.

Update: There is a capability create_posts but it's not well publicised and also has issues surrounding it which I'm afraid I don't have time to look into at the moment.

There are already answers that might help:

https://stackoverflow.com/a/3248103

https://wordpress.stackexchange.com/a/178059/94267


Original answer:

There is publish_posts. You need to turn this off for those users. Removing this capability doesn't prevent a user or role from writing a draft post, but it does prevent them from publishing it, so it won't be seen outside the admin.

Currently (WP 4.6) posts have these capabilities associated with them:

edit_posts
edit_others_posts
publish_posts
read_private_posts  
delete_posts
delete_private_posts
delete_published_posts
delete_others_posts
edit_private_posts
edit_published_posts

You probably want to disallow the *_private_* capabilities for anyone but Admins too.

6
  • Is there no possibility to add the create_post cap to the post type?
    – Sam
    Oct 3, 2016 at 11:40
  • There is no such thing as a create_post cap. If you've added your custom post type using a plugin, then that plugin may also manage a create_thing for the thing CPT, and you could write code to mirror that for the built-in post type. Without knowing what it does in detail, I can't do that. Oct 3, 2016 at 11:53
  • For my CPT's I have added the 'create_post' capability and set it to create_CTP-name. In the Members plugin create_CTP-name now shows up and it works like a charm. The only problem occurs with the built in post post type. My proofreaders should only be able to read and edit existing posts of any type, but not create new ones. Adding the create_post cap is really nice, because when set to false, the user does not have the "Add New" button.
    – Sam
    Oct 3, 2016 at 11:58
  • It's a false sense of security though: They can edit an existing post to have whatever they like in it! I'll see if I can dig up anything in my own code that will help. Oct 3, 2016 at 12:02
  • I'm also talking rubbish - there is something about create_post that isn't in my own references. I'll do a bit of searching for you and clarify my answer. Oct 3, 2016 at 12:04

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.