Snippet to Hide Snippets (from Menu)
-
I am using the following piece of code to hide the Users menu from the admin area.
function remove_admin_menus() { // provide a list of usernames who can edit custom field definitions here $admins = array( 'Super Admin Username', ); // get the current user $current_user = wp_get_current_user(); // match and remove if needed if( !in_array( $current_user->user_login, $admins ) ) { remove_menu_page( 'users.php' ); //Users } } add_action( 'admin_menu', 'remove_admin_menus', 999 );
This way only the named “Super Admin” can edit the user database.
The question is, how do I hide access to Code Snippets to prevent other admins from deactivating the code?!
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Snippet to Hide Snippets (from Menu)’ is closed to new replies.