jumust
Member
Posted 4 months ago #
Hi I have this function
<?php
$the_query = new WP_Query( array( 'tag__in' => array( 32, 33, 34 ) ), 'posts_per_page' => 3 );
while ( $the_query->have_posts() ) : $the_query->the_post();
?>
what's wrong, if I use only tag_in it works. Can I combine tag_in and post_per_page?
<?php
$args = array(
'tag__in' => array( 32, 33, 34 ),
'posts_per_page' => 3
);
$my_query = new WP_Query( $args );
while ( $my_query->have_posts() ) : $my_query->the_post();
?>
jumust
Member
Posted 4 months ago #
Thanks it works but it gets the 3 most recent posts (whatever of those 3 tags) and not ONE POST FOR EACH TAG. What should I add?
Then you need 3 loops - 1 for each tag.