Skip to content

Instantly share code, notes, and snippets.

@FriendlyWP
Created November 22, 2013 00:55
Show Gist options
  • Save FriendlyWP/7592826 to your computer and use it in GitHub Desktop.
Save FriendlyWP/7592826 to your computer and use it in GitHub Desktop.
Remove menu items (hide menu items) for everyone except a specific user.
/*
* See http://wordpress.stackexchange.com/a/28784/16 for all options
*/
add_action( 'admin_menu', 'my_remove_menu_pages', 9999 );
function my_remove_menu_pages() {
global $current_user;
$username = $current_user->user_login;
if ($username !== 'SPECIFIC-ADMIN-USERNAME-HERE') {
remove_menu_page('edit-comments.php');
remove_menu_page('edit.php?post_type=acf');
remove_menu_page('plugins.php');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment