save_post action-hookWP 1.5.0

Fires once a post has been saved.

Usage

add_action( 'save_post', 'wp_kama_save_post_action', 10, 3 );

/**
 * Function for `save_post` 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_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 1.5.0 Introduced.

Where the hook is called

wp_insert_post()
save_post
wp_publish_post()
save_post
WP_Customize_Manager::trash_changeset_post()
save_post
wp-includes/post.php 4828
do_action( 'save_post', $post_id, $post, $update );
wp-includes/post.php 5002
do_action( 'save_post', $post->ID, $post, true );
wp-includes/class-wp-customize-manager.php 3113
do_action( 'save_post', $post->ID, $post, true );

Where the hook is used in WordPress

wp-includes/default-filters.php 537
add_action( 'save_post', 'delete_get_calendar_cache' );