Do not allow users to create new posts and pages

Use remove_cap for this.

function remove_proofreader_create_posts(){
    global $wp_roles;
    $wp_roles->remove_cap( 'proof_reader', 'create_posts' );
    $wp_roles->remove_cap( 'proof_reader', 'create_pages' );
}

NOTE: This is not a global function, but a method of the WP_Roles, WP_Role and WP_User classes. It must be called using an instance of one of these classes, as shown in the examples.

ALSO: You’ll want to call the function once, as in during plugin activation, not on a constant hook.

Reference: https://codex.wordpress.org/Function_Reference/remove_cap

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)