Action hook 'post_updated'

in WP Core File wp-includes/post.php at line 5079

View Source

post_updated

Action Hook
Description
Fires once an existing post has been updated.

Hook Information

File Location wp-includes/post.php View on GitHub
Hook Type Action
Line Number 5079

Hook Parameters

Type Name Description
int $post_id Post ID.
WP_Post $post_after Post object following the update.
WP_Post $post_before Post object before the update.

Usage Examples

Basic Usage
<?php
// Hook into post_updated
add_action('post_updated', 'my_custom_function', 10, 3);

function my_custom_function($post_id, $post_after, $post_before) {
    // Your custom code here
}

Source Code Context

wp-includes/post.php:5079 - How this hook is used in WordPress core
<?php
5074  		 *
5075  		 * @param int     $post_id      Post ID.
5076  		 * @param WP_Post $post_after   Post object following the update.
5077  		 * @param WP_Post $post_before  Post object before the update.
5078  		 */
5079  		do_action( 'post_updated', $post_id, $post_after, $post_before );
5080  	}
5081  
5082  	/**
5083  	 * Fires once a post has been saved.
5084  	 *

PHP Documentation

<?php
/**
		 * Fires once an existing post has been updated.
		 *
		 * @since 3.0.0
		 *
		 * @param int     $post_id      Post ID.
		 * @param WP_Post $post_after   Post object following the update.
		 * @param WP_Post $post_before  Post object before the update.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 3
  • File: wp-includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.