Support

Account

Home Forums General Issues Hiding a field on the admin screen Reply To: Hiding a field on the admin screen

  • Well, if you’re using ACF pro, there is a hook you can use to remove the field on the back end, but it’s not something that’s documented. I have a plugin that lets you set removal of field by user type. You could use the hook I’m using to remove specific field if is_admin() returns true.

    You may need to play with this a bit to get it to work, the ACF hook is acf/get_fields, like I said, it’s not documented.

    You can find it called on line 740 of /api/api-field.php. You need to set the priority > 10 to run after the internal ACF filter.

    
    add_filter('acf/get_fields', 'your_function_name', 20, 2);
    function your_function_name($fields, $parent) {
      // remove the fields you don't want
      return $fields;
    }
    

    It’s just a starting point. $fields can be a nested array of fields => sub_fields.

    If you want you can see how I do this for user types on line 89 of this file https://github.com/Hube2/acf-user-role-field-setting/blob/master/acf-user-role-field-setting.php