• Resolved jumust

    (@jumust)


    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?

Viewing 3 replies - 1 through 3 (of 3 total)
  • <?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();
    ?>
    Thread Starter jumust

    (@jumust)

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Query tag and post per page’ is closed to new replies.