• Resolved kriskrukkert

    (@kriskrukkert)


    Hello,

    When my archive returns the results for a tag the results are not returned properly on the second page. When I use $paged var, the posts on the second page are not of the right tag. And without $paged it also returns the posts of the first page.

    What am I doing wrong here?

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args = array(
    	'posts_per_page'   => 5,
     	'post_status'      => 'publish',
     	'suppress_filters' => true,
     	'paged' => $paged
    );
    
    query_posts( $args );
    
    while ( have_posts() ) : the_post();
Viewing 1 replies (of 1 total)
  • Thread Starter kriskrukkert

    (@kriskrukkert)

    Hey Ho! figured it out! I don’t know if its the best solution but it works.

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $the_tag = single_tag_title("", false);
    
    $args = array(
    	'posts_per_page'   => 5,
     	'post_status'      => 'publish',
     	'suppress_filters' => true,
     	'tag' => $the_tag,
    	'paged' => $paged
    );
    
    query_posts( $args );
    
    while ( have_posts() ) : the_post();
Viewing 1 replies (of 1 total)

The topic ‘Pagination is not working properly with tags’ is closed to new replies.