I cannot get this query to work properly. It just renders one post even though I have three posts that are categories in the 'Firm News' and 'Test' categories.
Can anyone see a problem with my code?
<?php
$myquery = array(
'post_type' => 'post',
'tax_query' => array(
'relation' => 'OR',
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array('test', 'firm-news'),
)
),
'posts_per_page' => 5,
'orderby' => 'RAND',
);
$m = new WP_Query( $myquery );
if ( $m->have_posts() ) : $m->the_post();?>
<ul><li <?php post_class();?>><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li></ul>
<?php endif; wp_reset_postdata(); ?>
Thanks
Matt
relationonly works if you got multiple arrays/arguments. Have you tried moving the second term to another arguments? – kaiser Jan 28 at 4:20