WordPress.org

Make WordPress Core

Ticket #5317: 5317_for_24.diff

File 5317_for_24.diff, 1.4 KB (added by MichaelH, 6 years ago)

for trunk 2.4 bleeding

  • wp-includes/post.php

     
    365365        $query .= empty( $post_type ) ? '' : $wpdb->prepare("AND post_type = %s ", $post_type); 
    366366        $query .= empty( $post_status ) ? '' : $wpdb->prepare("AND post_status = %s ", $post_status); 
    367367        $query .= "$exclusions $inclusions " ; 
    368         $query .= empty( $category ) ? '' : $wpdb->prepare("AND ($wpdb->posts.ID = $wpdb->term_relationships.object_id AND $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id AND $wpdb->term_taxonomy.term_id = %d) ", $category); 
     368        $query .= empty( $category ) ? '' : $wpdb->prepare("AND ($wpdb->posts.ID = $wpdb->term_relationships.object_id AND $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id AND $wpdb->term_taxonomy.term_id = %d ", $category) . "AND $wpdb->term_taxonomy.taxonomy = 'category')"; 
    369369        $query .= empty( $post_parent ) ? '' : $wpdb->prepare("AND $wpdb->posts.post_parent = %d ", $post_parent); 
    370370        // expected_slashed ($meta_key, $meta_value) -- Also, this looks really funky, doesn't seem like it works 
    371371        $query .= empty( $meta_key ) | empty($meta_value)  ? '' : " AND ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value = '$meta_value' )";