Okay, I asked the question and then immediately answered it myself. You can see in includes/fields/class-acf-field-taxonomy.php line 15 that the terms are saved to the post with a priority of 15. If you don’t specify the priority of your acf/save_post function, it defaults to 10, which will run before the terms save. The easy fix for me was the change my function priority to 20. Everything still works and now my terms are saving on new posts!
Would like to add that 4+ years later, this is still an issue. Same setup for me:
I mostly understand why this is happening. But to avoid needing to use
wp_set_object_terms(), is it possible for me to use another acf filter that fires after the terms are normally saved to the post in order to finish off the redirect?
I can give this a go. Thanks for the link. For as much as the ACF API can handle, I’m kind of surprised it doesn’t have built in field option editing. Seems like an instinctual use, especially since the conditional logic parts are philosophically the same.
Yeah, that seems pretty messy. I don’t know that it’s a requirement, however, that this is a select2 select field. I just started from that angle. Assuming I just have a normal select field (ie, didn’t toggle ‘Stylized UI’ on the field), could I use the ACF JS API to dynamically change/add/delete options?
Is there a way to add a link on each gallery image per instance of a gallery, rather than only once per media attachment?
Eg, ‘About Us’ has a gallery that uses the image ‘Frog’ that links to google.com.
‘Contact Us’ has a gallery that uses the same ‘Frog’ image, but I want that one to link to bing.com.
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!
© 2022 Advanced Custom Fields.