I need to stop any site user who is a 'contributor' from editing the standard posts, but I want them to be able to edit a custom post type called courses. Here is my code that I have so far, it is not working: Activation of theme:
function remove_editor_read_private_posts(){
global $wp_roles;
$wp_roles->remove_cap( 'contributor', 'edit_post' );
}
add_action( 'after_setup_theme', 'remove_editor_read_private_posts' );
The above code needs to remove the ability to edit standard posts, but allow contributors to edit a custom post type called courses. Before this code contributors can edit both standard and the custom post type called courses.
Deactivation of theme:
function remove_editor_read_private_poststwo(){
global $wp_roles;
$wp_roles->add_cap( 'contributor', 'edit_post' );
}
add_action( 'switch_theme', 'remove_editor_read_private_poststwo' );