save_post_(post_type)
Fires once a post has been saved.
The dynamic portion of the hook name, $post->post_type, refers to the post type slug.
Possible hook names include:
Usage
add_action( 'save_post_(post_type)', 'wp_kama_save_post_type_action', 10, 3 ); /** * Function for `save_post_(post_type)` action-hook. * * @param int $post_id Post ID. * @param WP_Post $post Post object. * @param bool $update Whether this is an existing post being updated. * * @return void */ function wp_kama_save_post_type_action( $post_id, $post, $update ){ // action... }
- $post_id(int)
- Post ID.
- $post(WP_Post)
- Post object.
- $update(true|false)
- Whether this is an existing post being updated.
Changelog
Since 3.7.0 | Introduced. |
Where the hook is called
save_post_(post_type)
save_post_(post_type)
wp-includes/post.php 4880
do_action( "save_post_{$post->post_type}", $post_id, $post, $update );
wp-includes/post.php 5062
do_action( "save_post_{$post->post_type}", $post->ID, $post, true );
wp-includes/class-wp-customize-manager.php 3115
do_action( "save_post_{$post->post_type}", $post->ID, $post, true );
Where the hook is used in WordPress
wp-includes/default-filters.php 720
add_action( 'save_post_wp_template_part', 'wp_set_unique_slug_on_create_template_part' );