Home Forums Feature Requests Hide Elements for specific user roles


Hide Elements for specific user roles

  • Hello,

    ist it possible to hide elements ( ) only for specific user roles?

    Thanks in advance!

  • You could try this

  • Thanks for your reply.

    But I don’t want to hide FIELDS, I want to hide elements on the page like the editor etc. This is the option in the settings:

  • No, that is not possible through settings. You can create a filter, there is an undocumented filter acf/get_field_group

    add_filter('acf/field_group', 'my_change_field_group');
    function my_change_field_group($group) {
      if ($group['key'] = 'group_your-group-key') {
        // check current user role
        // set $group['hide_on_screen'] with array of things you want to hide
        // look at an exported field group for examples of what goes here
      return $group;
  • Ok, I will try that.

    Thank you!

    • oMikR0n

    • September 24, 2020 at 7:55 pm

    @hube2 I think that this filter stopped working in the latest version 🙁

  • It depends on what you’re trying to hide on screen and what editor you’re using. If you using guberbuggutenberg then hiding the editor will not work. Not sure about other things.

    • jmslbam

    • October 8, 2020 at 12:07 am

    @omikr0n please use “acf/get_field_group” because the code snippet uses an incorrect “acf/field_group”.

    But I still can’t seem to hide the group through PHP with this filter.

    Even if I’m setting the $group[‘active’] to false.

    • jmslbam

    • October 8, 2020 at 1:08 am

    I managed to remove a group via the metabox removal code

    remove_meta_box('acf-group_58638dba80441', 'your-custom-post-type-here', 'normal');

    ‘normal` can also be ‘side’ depending on the position.


    Is this what helps y’all?

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

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.