Home › Forums › Backend Issues (wp-admin) › Hide ACF on WP MultiSite › Reply To: Hide ACF on WP MultiSite
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!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.