diff --git a/wp-includes/comment.php b/wp-includes/comment.php index f7ddbc478f..52879ebbe5 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -1187,15 +1187,9 @@ function wp_delete_comment($comment_id, $force_delete = false) { clean_comment_cache($comment_id); - /** - * Fires immediately before changing the comment's status to 'delete'. - * - * @since 1.5.0 - * - * @param int $comment_id The comment ID. - * @param string $status The new 'delete' comment status. - */ + /** This action is documented in wp-includes/comment.php */ do_action( 'wp_set_comment_status', $comment_id, 'delete' ); + wp_transition_comment_status('delete', $comment->comment_approved, $comment); return true; } @@ -1777,17 +1771,17 @@ function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) $comment = get_comment($comment_id); /** - * Fires after a comment status has been updated in the database. - * - * The hook also fires immediately before comment status transition hooks are fired. + * Fires immediately before transitioning a comment's status from one to another + * in the database. * * @since 1.5.0 * - * @param int $comment_id The comment ID. - * @param string|bool $comment_status The comment status. Possible values include 'hold', - * 'approve', 'spam', 'trash', or false. + * @param int $comment_id Comment ID. + * @param string|bool $comment_status Current comment status. Possible values include + * 'hold', 'approve', 'spam', 'trash', or false. */ do_action( 'wp_set_comment_status', $comment_id, $comment_status ); + wp_transition_comment_status($comment_status, $comment_old->comment_approved, $comment); wp_update_comment_count($comment->comment_post_ID);