deleted_comment

deleted_comment

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: action
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.7.2

do_action('deleted_comment') is found 2 times:

  • /wp-content/plugins/akismet/class.akismet.php line 591
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
        $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->comments} WHERE comment_id IN ( " . $format_string . ' )', $comment_ids ) );
        $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->commentmeta} WHERE comment_id IN ( " . $format_string . ' )', $comment_ids ) );
     
        foreach ( $comment_ids as $comment_id ) {
            do_action( 'deleted_comment', $comment_id, $comments[ $comment_id ] );
            unset( $comments[ $comment_id ] );
        }
     
        clean_comment_cache( $comment_ids );
        do_action( 'akismet_delete_comment_batch', is_countable( $comment_ids ) ? count( $comment_ids ) : 0 );
    }
  • /wp-includes/comment.php line 1517
    1513
    1514
    1515
    1516
    1517
    1518
    1519
    1520
    1521
    1522
    *
     * @param string     $comment_id The comment ID as a numeric string.
     * @param WP_Comment $comment    The deleted comment.
     */
    do_action( 'deleted_comment', $comment->comment_ID, $comment );
     
    $post_id = $comment->comment_post_ID;
    if ( $post_id && 1 == $comment->comment_approved ) {
        wp_update_comment_count( $post_id );
    }

See this hook used in plugins: