I’m using ACF for WordPress and I’ve made an update to it. After that it seemed to work ok until I’m trying to display the value of a field. In admin everything works ok. The custom field value is saved. But when I do a var_dump I get bool false:
<?php
$my_field = get_field('my_field');
var_dump($my_field);
?>
And when I replace the get_field value with the custom field key I get array{}:
<?php
$my_field = get_field('field_5245445r7a7po');
?>
I’ve tried creating other custom field. The field is created and saved. Same result. Nothing displaying.
I’ve also downgraded the plugin to the previous version. Nothing seems to work.
What will be a possible solution to resolve this?
Thank you.
Hmm. Looks like I solved this on my own. I’ll post the answer, maybe this will help someone else.
So, in my case, I had a custom query with a while loop for posts before the get_field action. What I had to do to resolve my problem? Used the next code after the loop, before the get_field action: