I'm just walking around in circles here trying to figure this out, but I have a custom user role Dealer
who should only be able to edit a Page that he is the Author of. But I don't want this user to be able to create any new Pages.
I'm using the Member plugin to manage Roles currently.
I'd also like to ensure that the "Add New" menu item is removed for this user role. I've tried the follow to no avail:
function cm_redirect_users_by_role() {
if ( ! defined( 'DOING_AJAX' ) ) {
$current_user = wp_get_current_user();
$role_name = $current_user->roles[0];
if ( 'dealer' === $role_name ) {
remove_menu_page('post-new.php?post_type=page');
// wp_redirect( 'http://www.mywebsite.com/' );
} // if
} // if DOING_AJAX
} // cm_redirect_users_by_role
add_action( 'admin_init', 'cm_redirect_users_by_role' );