Support

Account

Home Forums General Issues Hide user custom fields from non-administrators

Solved

Hide user custom fields from non-administrators

  • Does ACF have a way to define custom fields for a user that are only visible to an administrator?

    I’ve tried playing around with the rule groups, but nothing seemed to work.

    i can separate out the fields I need to add for users into 2 different field groups (visible by user, visible only to admin), but is there an ACF filter hook I can use to control what gets displayed?

  • Hi @digitalquery

    I will be adding this functionality in soon, but for now, you can use a filter called load_field. This is documented over on the docs page.

    If you hook into the load_field filter and return false, the field will net be rendered. Therefore, within the filter, you can run some logic to look at the logged in user and return false if needed.

    Thanks
    E

  • Thanks Elliot – quick follow up, is there an easy way to test what field group a particular field belongs to?

  • Hi @digitalquery

    Yep, once you have got the field object, you will find the field group ID like so:

    
    $field['field_group']
    

    Thanks
    E

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Hide user custom fields from non-administrators’ is closed to new replies.