wp_insert_comment
Fires immediately after a comment is inserted into the database.
Usage
add_action( 'wp_insert_comment', 'wp_kama_insert_comment_action', 10, 2 ); /** * Function for `wp_insert_comment` action-hook. * * @param int $id The comment ID. * @param WP_Comment $comment Comment object. * * @return void */ function wp_kama_insert_comment_action( $id, $comment ){ // action... }
- $id(int)
- The comment ID.
- $comment(WP_Comment)
- Comment object.
Changelog
Since 2.8.0 | Introduced. |
Where the hook is called
wp_insert_comment
wp-includes/comment.php 2073
do_action( 'wp_insert_comment', $id, $comment );