wp_insert_comment
Fires immediately after a comment is inserted into the database.
Использование
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.
Список изменений
| С версии 2.8.0 | Введена. |
Где вызывается хук
wp_insert_comment
wp-includes/comment.php 2173
do_action( 'wp_insert_comment', $id, $comment );