Does get_posts() support tax_query?
-
The codex says that get_posts uses all the same arguments as query_posts, so why doesn’t the tax_query work with get_posts?
$myquery['tax_query'] = array( array( 'taxonomy' => 'portfolio-tags', 'terms' => array('bacon'), 'field' => 'slug', ), ); $myposts = get_posts( $myquery ); if ($myposts) : echo "bacon here!" else: echo "no freaking bacon"; endif;
echos out “no freaking bacon” which is obviously not the end result i want, but was a quick way to test whether it was pulling any data.
but if i change $myposts to
$myposts = query_posts( $myquery );
then i get a result.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Does get_posts() support tax_query?’ is closed to new replies.