A Hook That Fires Twice — and How Not to Trigger an Infinite Loop When Saving a Post
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`.