Remove ability to access certain admin menus
-
Hello, at first I want to thank you so much for the great plugin!!!
and I will be very grateful for your help:
I am trying to remove some of the admin features for a user with the custom role. What i mean by remove some of the admin features is disable them from seeing certain admin menu items, such as comments, tools, media ect. I have managed to remove the items I want from the admin menu, using this code:
add_action( 'admin_menu', 'members_remove_menu_pages' ); function members_remove_menu_pages() { $user = wp_get_current_user(); if ( in_array('editor', $user->roles) ) {remove_menu_page( ‘tools.php’);
remove_menu_page(‘edit.php?post_type=plugins’);
remove_menu_page(‘edit-comments.php’);
remove_menu_page(‘edit.php?post_type=elementor_library’);
remove_menu_page(‘edit.php?post_type=elementor_cf_db’);`
}
}`It works a treat. The problem I am facing is that I can just manually add the query string to the url, eg /wp-admin/tools.php and that will take me to the tools screen. Does anyone know a way to restrict these pages from being accessed altogether, as well as hiding them from the admin menu?
Thank you!
The topic ‘Remove ability to access certain admin menus’ is closed to new replies.