Support

Account

Home Forums Backend Issues (wp-admin) How to get field groups by name or location rules?

Unread

How to get field groups by name or location rules?

  • Overall idea: I want to be able to get my field groups without hardcoding the ID.

    What I’ve done so far is to filter location rules in acf_get_field_groups($filter):

    $return_data  = acf_get_field_groups(array(
                    "user_role"     => "administrator",
                    "current_user"  => "viewing_back",
                    "user_form" => "edit"
                ));
    

    1) The code above only works when the field group has a SINGLE location rule(no other rules) that matches the filter. How do I use acf_get_field_groups($filter) when I want to get a field group that either matches TWO or more location rules?

    Thanks!

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.