Home › Forums › Backend Issues (wp-admin) › Remove ACF from Wp-admin Menu › Reply To: Remove ACF from Wp-admin Menu
I recognize that this is an old thread, but wanted to add something that I constructed using this info that I found handy. I used ACF to add a true/false field to user forms. I called it “show_custom_fields_admin”. Then I use the above code in conjunction with the value of that true/false field to hide or display the ACF menu.
function remove_acf_menu(){
global $current_user;
$show = get_field('show_custom_fields_admin',$current_user);
if (!$show){
remove_menu_page( 'edit.php?post_type=acf-field-group' );
}
}
add_action( 'admin_menu', 'remove_acf_menu', 100 );
When adding the true/false field to the user form, be sure to show it only if the user’s role is “admin”.
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.