Where fields appear

ACF location rules builder

Build the location array for a field group: pick the parameters, combine rules with AND and OR, and copy PHP or JSON.

Presets

              

              

Quick answer: An ACF location array is a list of groups; each group is a list of rules. Rules inside a group must all match (AND), and a field group shows when any one group matches (OR). Build the rules above and copy the PHP array into your acf_add_local_field_group() call.

How AND and OR work

Each outer array is an OR group. Each rule inside it is an AND condition. For example, "post type is post and category is news" is one group with two rules, while adding "or post type is page" is a second group.

Common parameters

Frequently asked questions

Where does the location array go?

Inside your acf_add_local_field_group() call as the 'location' key, or in the exported JSON as "location".

What is the difference between page and post_type?

post_type matches every post of that type; page matches one specific page by ID, and page_template or page_type narrow it by template or role such as the front page.

How do I target a category or taxonomy term?

Use post_category or post_taxonomy with the value category:slug or taxonomy:slug, for example category:news.

How do I show a field group on an options page?

Use the options_page parameter with the menu slug you registered, for example acf-options-site-settings.

How do I attach fields to a block?

Use the block parameter with the block name, such as acf/testimonial.