I then tried to repeat something similar to ADD the post title upon first submit from the same acf field with the help of this explanation.
After testing with exits, I noticed
new_post is never the variable so it never reaches the rest of the code.
I echoed the post_id with an exit (before line 10) and it always returned an ID, so the script returns the ID on line 10 and never passes that.
When I commented out the return, I got 2 new posts instead of one. One did now actually have the title as I wanted it but the second one is also inserted.
So I removed the insert and added an update to change the post title and name.
Can you take a look at this function and see if all looks good ?
It appears to work as expected and all, but would like to make sure it’s all on the up and up.
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!