There is a save_post hook that is run when you save a post. In fact, revisions and autosaves also call this hook. Even if you simply change the status from published to draft it triggers the save_post
hook.
Is there any way (using normal wp methods) that a post could be modified without calling save_post
? (like editing custom fields)
I’m wondering if I need to tie into transition_post_status
or updated_postmeta
or if save_post
is enough.
TL;DR: No, you can use save_post
. Unless you consider programmatic modification of only metadata “modifying a post”.
There (theoretically) is a way of modifying a post without triggering the save_post
action hook: Direct modification of the database.
But for one no plugin or theme author in his right mind would go that route and for another it would circumvent all other possible action hooks as well.
The other hooks you mention are for entirely different use-cases:
update_post_meta
or updated_postmeta
run only when metadata is changed, i.e. not when only title or content are edited.
transition_post_status
will not run when a published post is merely edited.
Iff you consider programmatic updates of post metadata a modification of the post itself you will indeed have to tie into the update_post_meta
hook or the like as well. The update_post_meta()
function calls update_metadata()
(source on trac) which will run several action hooks (see linked source), but indeed not save_post
.