WordPress.org

Make WordPress Core

Ticket #20193: 20193.diff

File 20193.diff, 1.1 KB (added by benbalter, 3 years ago)
  • wp-includes/post.php

     
    19051905 * @return string The SQL AND clause for mime searching. 
    19061906 */ 
    19071907function wp_post_mime_type_where($post_mime_types, $table_alias = '') { 
     1908        global $wpdb; 
     1909         
     1910        //always prefix table names in case a filter added a join 
     1911        // see: #20193 
     1912        if ( $table_alias == '' ) 
     1913                $table_alias = $wpdb->posts; 
     1914 
    19081915        $where = ''; 
    19091916        $wildcards = array('', '%', '%/%'); 
    19101917        if ( is_string($post_mime_types) ) 
     
    19321939                        return ''; 
    19331940 
    19341941                if ( false !== strpos($mime_pattern, '%') ) 
    1935                         $wheres[] = empty($table_alias) ? "post_mime_type LIKE '$mime_pattern'" : "$table_alias.post_mime_type LIKE '$mime_pattern'"; 
     1942                        $wheres[] = "$table_alias.post_mime_type LIKE '$mime_pattern'"; 
    19361943                else 
    1937                         $wheres[] = empty($table_alias) ? "post_mime_type = '$mime_pattern'" : "$table_alias.post_mime_type = '$mime_pattern'"; 
     1944                        $wheres[] = "$table_alias.post_mime_type = '$mime_pattern'"; 
    19381945        } 
    19391946        if ( !empty($wheres) ) 
    19401947                $where = ' AND (' . join(' OR ', $wheres) . ') ';