Support

Account

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”.