Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Ajax search pro custom fields problem › Reply To: Ajax search pro custom fields problem
Well, all I can conclude is that the ACF get_field(..) is not returning the correct values for some reason – and the problem is, that I could not find any conflicts. We should wait for response from the ACF team, as they know their product better. Please let me know if you get any response. I also looked through almost all past tickets that is related to ACF, but there was no similar issue to this, which is very weird.
If you want, you can pass this message to the ACF team:
NOTE: The issue below is within an ajax context, also, not within a posts loop. (call to the wp-admin/admin-ajax.php file)
I have tried getting the post meta value (drop-down type), via the ACF API get_field function, like so:
$value = get_field('field_name', $post_id);
..however, the value returned was always the drop-down value, and not the label. Then, to resolve the key -> value pairs, I tried getting the field object choices, like so:
$fo = get_field_object('field_name');
..however, the $fo[‘choices’] did not contain the choices in every case, as it should. In this case, it returned correctly for the Transmition field, however not for the Fuel Type – which is very weird, as both fields are drop-down type.
Then, I also tried getting the choices via parsing the
$GLOBALS['acf_register_field_group']
..global variable, however that did not contain the choices either.
As a last resort, I also tried getting the choices via using the field key within the get_field_object(..) call, but that did not make any difference either.
Any help on this issue would be greatly appreciated. Thank you!