Skip to content

Instantly share code, notes, and snippets.

@barbwiredmedia
Created May 13, 2014 18:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barbwiredmedia/98a981f143605a934b5f to your computer and use it in GitHub Desktop.
Save barbwiredmedia/98a981f143605a934b5f to your computer and use it in GitHub Desktop.
Hide ACF menu item from the admin menu
/**
* Hide ACF menu item from the admin menu
*/
function remove_acf_menu()
{
// provide a list of usernames who can edit custom field definitions here
$admins = array(
'levy-admin',
'fakename'
);
// 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('edit.php?post_type=acf'); //ACF
remove_menu_page('tools.php'); //Tools
}
}
add_action( 'admin_menu', 'remove_acf_menu' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment