Consider a Field Group with two Post Object selectors:
$fields = array(
array (
'key' => 'field_a',
'label' => __('All Projects', 'foobar'),
'name' => 'all-projects-selector',
'type' => 'post_object',
'post_type' => 'project',
),
array (
'key' => 'field_b',
'label' => __('Parent Projects', 'foobar'),
'name' => 'parent-projects-selector',
'type' => 'post_object',
'post_type' => 'project',
'meta_query' => array( array(
'key' => 'post_parent',
'compare' => '=',
'value' => 0,
) ),
),
);
$args = array (
'key' => 'group_a',
'id' => 'some-fields',
'fields' => $fields,
'title' => __('Top-Level Project or Project Page selector', 'foobar'),
);
acf_add_local_field_group($args);
I need the first selector to give a choice of all ‘projects’ items, and the second selector to give a choice of only those ‘project’ items which have no parent. How can I configure different filters for each field?
I have seen the following filter, but it seems to apply to _all_ fields:
https://www.advancedcustomfields.com/resources/acf-fields-post_object-query/