cannot get data from multiple categories
-
I have this function
$args = array ( 'cat' => '29,30,31,32', 'orderby' => 'rand', 'posts_per_page' => '1' ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); echo '<a href="'.get_the_permalink().'">'.get_the_post_thumbnail().'</a><br />'; endwhile; endif; wp_reset_postdata();It seems running correctly with one record is returned. But somehow, the link and the thumbnail returns nothing. If I replace the ‘cat’ with just one value, instead of 4 values, it’s working.
Am I wrong somewhere? Please suggest.
Thanks.
The topic ‘cannot get data from multiple categories’ is closed to new replies.