WordPress.org

Make WordPress Core

Ticket #21571: comment.diff

File comment.diff, 588 bytes (added by borkweb, 3 years ago)

Patch for adding multiple comment_type support

  • comment.php

     
    314314                        $where .= " AND comment_type = ''"; 
    315315                } elseif( 'pings' == $type ) { 
    316316                        $where .= ' AND comment_type IN ("pingback", "trackback")'; 
     317                } elseif ( ! empty( $type ) && is_array( $type ) ) { 
     318                        $type = array_map( 'sanitize_key', $type ); 
     319                        $where .= " AND comment_type IN ('" . join("', '", $type) . "')"; 
    317320                } elseif ( ! empty( $type ) ) { 
    318321                        $where .= $wpdb->prepare( ' AND comment_type = %s', $type ); 
    319322                }