wp_set_comment_status
Fires immediately after transitioning a comment's status from one to another in the database and removing the comment from the object cache, but prior to all status transition hooks.
Использование
add_action( 'wp_set_comment_status', 'wp_kama_set_comment_status_action', 10, 2 ); /** * Function for `wp_set_comment_status` action-hook. * * @param string $comment_id Comment ID as a numeric string. * @param string $comment_status Current comment status. Possible values include 'hold', '0', 'approve', '1', 'spam', and 'trash'. * * @return void */ function wp_kama_set_comment_status_action( $comment_id, $comment_status ){ // action... }
- $comment_id(строка)
- Comment ID as a numeric string.
- $comment_status(строка)
- Current comment status. Possible values include 'hold', '0', 'approve', '1', 'spam', and 'trash'.
Список изменений
С версии 1.5.0 | Введена. |
Где вызывается хук
wp_set_comment_status
wp-includes/comment.php 2454
do_action( 'wp_set_comment_status', $comment->comment_ID, $comment_status );
wp-includes/comment.php 1508
do_action( 'wp_set_comment_status', $comment->comment_ID, 'delete' );
Где используется хук в WordPress
wp-includes/comment.php 2418
add_action( 'wp_set_comment_status', 'wp_new_comment_notify_postauthor' );