Allowing custom role user to edit post assigned to them but don’t let them create new custom type post

You cannot find the capability because it does not exist. In WP out of the box, the paradigm is not post creation, but post publishing. Users can be adjusted to edit and create drafts and pending posts, but not publish. Setting users to only edit however is not possible at the roles and capabilities level, … Read more

Restrict specific private page to a specific user

I assume you’re using wp_insert_post() to create the private page for the user. The function returns the ID of the created page. You can use this ID as part of a custom capability you grant to the user. // create the new $user // create private page $private_page_id = wp_insert_post( $postarr, $wp_error = false ); … Read more

How to restrict subscriber editing other posts but read specific posts in backend

To query posts with more than one author ID, you can use author__in parameter. This makes posts from chosen authors visible (read only) for the current user. add_filter(‘pre_get_posts’, ‘posts_for_current_author’); function posts_for_current_author($query) { if ( $query->is_admin && ‘edit.php’ === $GLOBALS[‘pagenow’] && ! current_user_can( ‘edit_others_posts’ ) ) { $query->set(‘author__in’, array(get_current_user_id(), 1, 2, 3) ); // add 1 … Read more