I’m creating a post via the REST API. On the frontend, get_field_object() returns empty until I go into wp-admin and save a value for an ACF field at least once.
Then, all the fields I using get_field_object() will work, but not until then.
Is there a way to get around this?
I was a little preemptive on that one… It looks like using the field_key instead of the field name solved the issue.
I know its too late for you. But for others having the same issue, they can use acf_get_field('x')
. Today I also faced the same issue and it fixed by replacing get_field_object('name')
with cf_get_field('name')
function.
Took me some time to find out why https://www.advancedcustomfields.com/resources/creating-wp-archive-custom-field-filter/ was not working. Thanks to this thread managed to get it to work! Perhaps you guys can update the resource