Home › Forums › Front-end Issues › How to duplicate post on acf_form save ? › Reply To: How to duplicate post on acf_form save ?
First thing is that
acf/pre_saved_post will only work with an acf_form() on the front end of the site and will not work in the admin so
is_admin() is doing nothing for you. You’d need to do something completely different than using
acf/pre_saved_post if you want this to happen in the admin as well and I don’t know what that is.
Second issue is that in order to duplicate the post you need to omit the ‘ID’ value. $post_id already exists. According to the WP docs, this has the effect of updating the existing post rather than inserting the new post, so you are not changing the post ID.
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!
🚀 This week’s session of ACF Chat Fridays dips into the preliminary results of our first ever user survey. Don’t miss it! https://t.co/3UtvQbDwNm pic.twitter.com/kMwhaJTkZc— Advanced Custom Fields (@wp_acf) May 9, 2023
© 2023 Advanced Custom Fields.