Fetch only post category terms in get_posts(). Props MichaelH. fixes #5317
git-svn-id: http://svn.automattic.com/wordpress/trunk@6490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d1cdea8eb2
commit
0da0bf3436
|
@ -365,7 +365,7 @@ function get_posts($args) {
|
|||
$query .= empty( $post_type ) ? '' : $wpdb->prepare("AND post_type = %s ", $post_type);
|
||||
$query .= empty( $post_status ) ? '' : $wpdb->prepare("AND post_status = %s ", $post_status);
|
||||
$query .= "$exclusions $inclusions " ;
|
||||
$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);
|
||||
$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 AND $wpdb->term_taxonomy.taxonomy = 'category')");
|
||||
$query .= empty( $post_parent ) ? '' : $wpdb->prepare("AND $wpdb->posts.post_parent = %d ", $post_parent);
|
||||
// expected_slashed ($meta_key, $meta_value) -- Also, this looks really funky, doesn't seem like it works
|
||||
$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' )";
|
||||
|
|
Loading…
Reference in New Issue