Home Forums Backend Issues (wp-admin) fields to show based on user role?


fields to show based on user role?

  • wondering whether this can be done via the UI?

    I have a field group with many fields

    tab1 for compulsory fields, such as name, profession, etc.
    whatever role log in can see all the fields in this tab.

    tab2 for settings field, if the logged in user is role=editor, then no need to show, because don’t want to confuse editor by letting them configure more technical things at setting tab.

    so far I haven’t find any way to set rule.
    when I set the rule, it will apply globally to all the fields inside this group
    any way?

  • This can be done using an acf/prepare_field filter. You compare the current user with what you want to allow and then return the field if it should be shown or false if you don’t want it shown. Basically you would have to add this filter for the tab field and each of the fields in that tab that you don’t want shown.

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

You must be logged in to reply to this topic.