WordPress.org

Make WordPress Core

Ticket #5317: 5317_for_231.diff

File 5317_for_231.diff, 1.3 KB (added by MichaelH, 10 years ago)
  • wp-includes/post.php

     
    254254        $query .= empty( $post_type ) ? '' : "AND post_type = '$post_type' ";
    255255        $query .= empty( $post_status ) ? '' : "AND post_status = '$post_status' ";
    256256        $query .= "$exclusions $inclusions " ;
    257         $query .= empty( $category ) ? '' : "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 = " . $category. ") ";
     257        $query .= empty( $category ) ? '' : "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 = " . $category . " AND $wpdb->term_taxonomy.taxonomy = 'category') ";
    258258        $query .= empty( $post_parent ) ? '' : "AND $wpdb->posts.post_parent = '$post_parent' ";
    259259        $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' )";
    260260        $query .= " GROUP BY $wpdb->posts.ID ORDER BY " . $orderby . ' ' . $order;