Home › Forums › Backend Issues (wp-admin) › get_field_objects() empty till Save Draft is clicked › Reply To: get_field_objects() empty till Save Draft is clicked
Hi Hube2 – Thanks again for answering my post.
Unfortunately the issue is that I need the user to be able to edit their submitted post before any admin has the chance to come in click Save Draft, etc. So with that in mind, I have to be able to get the checkbox data out of ACF and back into GF so the user can edit checkboxes.
Now I can do this just fine if I hard code the field names into the php, but what I would like to do is use the get_field_objects() to test if an object is a checkbox, and if it is, get the name of the field so it can be mapped to the corresponding GF field and then update the data so the user can edit.
I do understand your explanation above, so, is there a way to trigger the Save Draft (I ask because I’ve not found the right hook yet) so that I can trigger that in the final GF hook. Basically, click Save Draft via php. This might not be possible since the Save Draft is a form that updates the post and post_meta, but hopefully there is a way.
Otherwise, yes, I could use get_post_meta() but then I’m counting on those meta field names to tell me what type of field the meta_field is. But maybe I just need to make another meta_field that maps everything out. Which gets back to my suggestion for a plugin to make these mappings. Seems like a fun project, but not in line with what I’m working on now. Guess I’ll just hardcode the field names in for the time being.
Thanks,
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.