Support » Plugins » UPDATE or INSERT

  • How do my fucntion in my plugin that is hooked to “save_post” know if its a update or a new post?

Viewing 1 replies (of 1 total)
  • Hi,

    I’m struggling with this too.

    The save_post, edit_post and publish_post hooks seem to be oddly ordered.

    First publish_post is triggered, but this happens after the post_status in the database has been set to publish. So no way to see if it’s a first time publish or an edit of a published page. Plus everytime a published post is edited publish_post is triggered as well.

    It just doesn’t seem logical. One would think publishing a post is something that happens only once. Also, it seems more logical if the publish_post action was triggered after save_post. Having save_post and edit_post both triggered when an existing post is edited is strange too.

    I guess our hopes are on this ticket:

Viewing 1 replies (of 1 total)
  • The topic ‘UPDATE or INSERT’ is closed to new replies.