WordPress.org

Make WordPress Core

Ticket #41228: 41228.diff

File 41228.diff, 591 bytes (added by henry.wright, 2 years ago)

41228.diff passes a 2nd argument to do_action(). This will allow full access to the deleted comment in hooked functions.

  • src/wp-includes/comment.php

    diff --git src/wp-includes/comment.php src/wp-includes/comment.php
    index 7055db7..f314508 100644
    function wp_delete_comment($comment_id, $force_delete = false) { 
    13111311         * @since 2.9.0
    13121312         *
    13131313         * @param int $comment_id The comment ID.
     1314         * @param WP_Comment $comment The deleted comment.
    13141315         */
    1315         do_action( 'deleted_comment', $comment->comment_ID );
     1316        do_action( 'deleted_comment', $comment->comment_ID, $comment );
    13161317
    13171318        $post_id = $comment->comment_post_ID;
    13181319        if ( $post_id && $comment->comment_approved == 1 )