Created
July 15, 2014 20:42
-
-
Save barbwiredmedia/04a6127510be4b68cefc to your computer and use it in GitHub Desktop.
Hide ACF menu item from the admin menu. wordpress functions.php
This file contains 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
/** | |
* 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-access', | |
'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('edit.php'); //Posts | |
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