A Hook That Fires Twice — and How Not to Trigger an Infinite Loop When Saving a Post

22 Sep 2026· Originally published on 4wp.dev ·WordPress Hooks

In short

  • `save_post` fires several times for one save: autosave, revision, final save.
  • Calling `wp_update_post()` inside `save_post` causes recursion, so the action must be removed and re-added.
  • Each task deserves its own CRUD hook: `transition_post_status`, `wp_insert_post`, `save_post`, `before_delete_post`.
Read the full article on 4wp.dev →