Home › Forums › Backend Issues (wp-admin) › how to detect if post is new or edited with pre_save_post()? › Reply To: how to detect if post is new or edited with pre_save_post()?
Usually, if it’s a new post then the post ID will be something like “new_post” or “new” or “new_???” depending on what you set the post ID for acf_form(). You should be checking for whatever you set there.
If you are using “new_post”, then this is a specific instance where ACF already has run it’s own pre_save_post filter. If you want to create your own pre_save_post filter then you should not use “new_post” as the post ID and use some other unique string. The reason is that ACF has already created the new post and a post ID has already been assigned to it.
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.