Support

Account

Home Forums General Issues get_field_object returns empty on newly created post

Solved

get_field_object returns empty on newly created post

  • 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.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.