I've used the following tutorial to register a new post type and restrict a custom role to that post type:


What do I need to do with my capabilities to have the user role only be able to view the [custom post type] items that they themselves create and not be able to view items created by others?

I do plan to also create another user role that will be able to view items created by anybody.

  • 1
    On the front end? Back end? Both? Please clarify the question
    – s_ha_dum
    May 29, 2015 at 16:59
  • @s_ha_dum On the back end.
    – George
    May 31, 2015 at 17:59

1 Answer 1


Instead of coming up with this functionality myself and re-inventing the wheel I'm using the built-in functionality that makes a post 'private'.

By using this I've had to force all posts to be private, I've done so using the wp_insert_post_data filter:

add_filter('wp_insert_post_data', array($this, 'post_data_save'), 10, 2);

And my method:

public function post_data_save($post){
    if($post['post_type'] == 'my_custom_post_type'){
            case 'publish': $post['post_status'] = 'private'; break;
    return $post;

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.