Action hook 'edit_post'

in WP Core File wp-includes/comment.php at line 2833

View Source

edit_post

Action Hook
Description
Fires immediately after a post's comment count is updated in the database.

Hook Information

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

Hook Parameters

Type Name Description
int $post_id Post ID.
int $new The new comment count.
int $old The old comment count.

Usage Examples

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

function my_custom_function($post_id, $new, $old) {
    // Your custom code here
}

Source Code Context

wp-includes/comment.php:2833 - How this hook is used in WordPress core
<?php
2828  
2829  	/** This action is documented in wp-includes/post.php */
2830  	do_action( "edit_post_{$post->post_type}", $post_id, $post );
2831  
2832  	/** This action is documented in wp-includes/post.php */
2833  	do_action( 'edit_post', $post_id, $post );
2834  
2835  	return true;
2836  }
2837  
2838  //

PHP Documentation

<?php
/**
	 * Fires immediately after a post's comment count is updated in the database.
	 *
	 * @since 2.3.0
	 *
	 * @param int $post_id Post ID.
	 * @param int $new     The new comment count.
	 * @param int $old     The old comment count.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 3
  • File: wp-includes/comment.php
Related Hooks

Related hooks will be displayed here in future updates.