We are using ACF for a site that is getting a lot of the content from an external API. I am calling the API from a cron job and part of that involves setting a field value on one of the custom fields we’ve defined for our custom post type. I see the values in the database, and if I run the import from the wp cli shell, I can retrieve the value with get_field(), but if I restart the shell or try to access the field from a post template via browser, get_field returns false.
Here is how I set the field in my import script:
update_field('riverstar_id', '1061', 5994);
Here is the data in the wp_postmeta table:
| 5994 | riverstar_id | 1061 | | 5994 | _riverstar_id | field_riverstar_id
Here is what i get when I call get_field():
wp> get_field('riverstar_id', 5873) => bool(false)
One thing I noticed is that field field is called “field_riverstar_id” whereas some of my other fields are called “field_588ba5368fd40” or some other random identifier. I don’t know why but this seems significant. “riverstar_id” is definitely defined in the custom field group, I have checked and re-checked it numerous times.
Any help would be appreciated. Thanks!
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!