Why is there both a save_post and wp_insert_post action?

wp_insert_post was introduced in changeset 2887, and was to fix bug #1681. I couldn’t find the save_post hook’s original provenance, but it was most recently added to core in changeset 3291, related to ticket #2063. Evidently it had existed in 1.5.2 (although version control does not support this theory) and needed to be added back for back-compat.

So apparently, save_post was added in 1.5.0, then somehow removed in the 2.0 development lifecycle, then wp_insert_post was later added in the 2.0 development lifecycle, and finally, save_post was added back even later in the 2.0 lifecycle so as not to break back-compat.

And rather than being the deprecated hook you’d expect such a hook to be if that’s true, it became the de facto default hook that developers use.

Leave a Comment