Created
May 2, 2019 04:56
-
-
Save aj-adl/fdb78e76022a78419a14e79ddcf3e314 to your computer and use it in GitHub Desktop.
Hide the ACF menu in the Wordpress admin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_namespace_remove_acf_from_admin_menu(){ | |
/* How you determing if it's production or not is up to you, we set a constant */ | |
if ( ! defined( 'WP_ENV' ) || WP_ENV !== 'production ) return; | |
/* You can whitelist some users by id, or with a little more code, their username etc*/ | |
$whitlisted_users = []; | |
if ( in_array( get_current_user_id(), $whitelist_users ) ) return ; | |
remove_menu_page('edit.php?post_type=acf-field-group'); | |
} | |
add_action( 'admin_menu', 'my_namespace_remove_acf_from_admin_menu' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment