Skip to content

Instantly share code, notes, and snippets.

@brandondove
Created February 24, 2011 06:56
Show Gist options
  • Save brandondove/841869 to your computer and use it in GitHub Desktop.
Save brandondove/841869 to your computer and use it in GitHub Desktop.
query_posts 3.1 vs 3.0.5 - SQL differences
<?php
/*
this works, but is it right to separate out the two categories here? I thought I could include both cat ids in the first terms array, but it seems that if I do that, it pulls any post that matches either category instead of both.
*/
query_posts( array(
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'category',
'terms' => array( 5629 ),
'field' => 'term_id',
),
array(
'taxonomy' => 'category',
'terms' => array( 5623 ),
'field' => 'term_id'
)
),
'posts_per_page' => -1,
'orderby' => 'title',
'order' => ASC
));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment