Home › Forums › General Issues › acf/save_post not firing on custom plugin/localhost › Reply To: acf/save_post not firing on custom plugin/localhost
I dug around a bit. I learned that
get_field_objects( get_the_ID() ) returns as false. Which tells me the fields don’t seem to be ‘connected’ to this post.
I started with a vanilla install again to test what happens without my plugin. Then the save function works as expected. So I concluded the flaw lies in my plugin. This code comes from the template provided by ACF, so I would think/expect it would work with that.
I checked through my file and I can’t see anything (yet) that would ‘stop’ values from being saved or the field from being ‘disconnected’. If I look in my database I can also see the stored Field group rule which is connected to posts, so that looks ok.
The normal save_post action works but I would still need get_field_objects to get the correct field key for it, to save it properly.
But then I probably run into the issue that the fields might not be loaded properly since the field is not recognised.
If I add a normal text field to the same group, its value does get stored….
So I just need to ‘connect’ this field to a post, then it should work I think.
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.