WordPress.org

Make WordPress Core

Ticket #12766: comment.php

File comment.php, 1.1 KB (added by briancolinger, 4 years ago)
Line 
1Index: ../Sites/wordpress-trunk/wp-includes/comment.php
2===================================================================
3--- ../Sites/wordpress-trunk/wp-includes/comment.php    (revision 13885)
4+++ ../Sites/wordpress-trunk/wp-includes/comment.php    (working copy)
5@@ -869,14 +869,15 @@
6  * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object
7  *
8  * @param int $comment_id Comment ID
9+ * @param bool $force_delete Whether to bypass trash and force deletion
10  * @return bool False if delete comment query failure, true on success.
11  */
12-function wp_delete_comment($comment_id) {
13+function wp_delete_comment($comment_id, $force_delete = false) {
14        global $wpdb;
15        if (!$comment = get_comment($comment_id))
16                return false;
17 
18-       if (wp_get_comment_status($comment_id) != 'trash' && wp_get_comment_status($comment_id) != 'spam' && EMPTY_TRASH_DAYS > 0)
19+       if ( !$force_delete && wp_get_comment_status( $comment_id ) != 'trash' && wp_get_comment_status( $comment_id ) != 'spam' && EMPTY_TRASH_DAYS > 0 )
20                return wp_trash_comment($comment_id);
21 
22        do_action('delete_comment', $comment_id);