I’ve always used the instructions at http://www.advancedcustomfields.com/resources/how-to/how-to-hide-acf-menu-from-clients/ to hide ACF from showing to my clients in the admin, but this is the first time I’ve used ACF with a MultSite install. I added the code as shown in http://www.advancedcustomfields.com/resources/how-to/how-to-hide-acf-menu-from-clients/ but when I log into a subsite on the site it continues to show the ACF menu item. I’ve made sure I am NOT logged in as a superadmin and I’m indeed logged in as the individual site admin ie: mydemosite.mydomain.com
Is there anything special I need to do to hide this from all admins except my super admin account?
I have solved it myself. It appears the function was not firing early enough.
Here is the modified code
/**
* 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(
'chad',
);
// 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');
}
}
add_action( 'admin_menu', 'remove_acf_menu', 999 );
Simply adding 999 to the action fixed it. If someone knows a more “proper” way to do it I’m all ears!
Hi @bluehiveinteractive
Thanks for posting your solution.
Many devs will thank you for this.
Cheers
E