A save_post handler that works perfectly in testing and loops infinitely in production — because of one missing remove_action() call. The full contract of all 4 save/CRUD hooks, from the 4wp.dev Hooks series.
This is part of the 4wp.dev Hooks series — one WordPress hook category, explained in production depth. Full catalog: https://4wp.dev/hooks/category/save-crud/ on 4wp.dev.
The Problem
A developer hooks save_post to sync a post to an external service on every save. The code works in testing — one save, one sync call. In production, the same save triggers the sync twice, sometimes three times, and occasionally the site hangs entirely on save.…