Support

Account

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!