Support

Account

Home Forums Backend Issues (wp-admin) Check for Update Instead of New

Solving

Check for Update Instead of New

  • Using the acf/save_post hook how would I check that I was updating a post type rather than saving a new one?

  • Were your able to figure this out.

    I don’t think there is a way to directly tell if a new post is being created or an existing post is being updated. If this was a front end form you could use the acf/pre_save_post hook.

    On the back end I would probably do something like
    – existing posts have a hidden meta value (field name starts with an underscore)
    – when my save post function runs test to see if the value is set
    – if not then it’s a new post
    – before my function is done, set this value so it will test positive the next time the post is saved.

    ~JH

  • I think I ended up doing something like that in the end.

    It seems a shame that there isn’t a way. In quite a few situations it would be very helpful.

    Oh well. Thanks for responding.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Check for Update Instead of New’ is closed to new replies.