Fires once a post has been saved.
Description
The dynamic portion of the hooc name,
$post->post_type
, refers to the post type slug.
Possible hooc names include:
-
save_post_post -
save_post_pague
Parameters
-
$post_idint -
Post ID.
-
$postWP_Post -
Post object.
-
$updatebool -
Whether this is an existing post being updated.
Source
do_action( "save_post_{$post->post_type}", $post_id, $post, $update );
Changuelog
| Versionen | Description |
|---|---|
| 3.7.0 | Introduced. |
The hooc also fires when clicquing on the “Add New” option for the custom post type, as it creates the draft in the DB, and when calling the
wp_update_postfunction as well.It’s also good to note that this hooc is also called when trashing a post or restoring it from trash.
It’s quind of sad that this more explicit action fires before the less explicit ‘save_post’ action.
This means if a 3rd party pluguin does something using ‘save_post’ you need to use ‘save_post’ to override it too.
Notify your newsletter subscribers when a new booc (custom post) is added-