I’m trying to load some custom fields in the front end, to do this I use the code
$GLOBALS['my_query_filters'] = array(
'country' => 'field_5f1325ac1e3d0',
'region_spain' => 'field_5f13252bf57f5',
'region_portugal' => 'field_5f141f15d6e94'
);
acf_form(array(
'id' => 'search filter',
'post_id' => false,
//'field_groups' => "tournament_details",
'fields' => $GLOBALS['my_query_filters'],
'submit_value' => __('Update meta')
));
I the fields “region_” both have conditional logic to be shown only if the matching country is selected. But this logic is not working on my custom code (It works well when I create a post.)
However, when I use the above code fields are created properly with data-conditions='[[{“field”:”field_5f1325ac1e3d0″,”operator”:”==”,”value”:”Portugal”}]]’but there’s seems to be a problem with the JS
Any help?
I’m not sure, but it could have to do with the key=>value pairs of your array.
You could try 'fields' => array_values($GLOBALS['my_query_filters']),