Specific post user permissions

You can conditionally control which user role has the capability to edit posts

edit_posts

By default, contributors can edit their posts however you can add or remove capabilities for different roles and user i.d’s.

add_action( 'init', 'new_role_edit_posts' ); 

function new_role_edit_posts() {

if ( is_single('007') {

$role = get_role( 'new-role' );
$role->add_cap( 'edit_posts' );
    }
}

This enables the new user role named new-role to edit the single post with the post i.d of 007

You will need to create a new role named new-role

Leave a Comment