I have a Post Object
field that allows for multiple references to 1 custom post type.
I set up some actions to watch for status changes using this pattern.
During this action I am sending some data to Algolia. I have noticed that I need to click “Update” twice for changes on this field to make its way to Algolia. Other field types on my record, Text
, Textarea
, Gallery
all update immediately.
Is there any reason there would be this “lag” for the Post Object
field type? I’ve tried changing it from a Post Object
return to Post ID
but that didn’t make a difference. I am using the get_field
function to get the field data in all cases.
add_action('publish_product', 'on_product_publish', 10, 2);
I am using this to add the action. I have tried to set the priority to 99 to see if it was a priority issue, but that also didn’t help.
Any advice would be appreciated.
I continued to work through some other fields on the post, the Repeater
field type also has this “lag”.
For post updates/publishing, looks like using the acf/save_post action was the one to use instead of the default WP ones.