0

In tag template I use the following query post:

                global $query_string; // required
                $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
                $posts =                    query_posts($query_string.'&posts_per_page=5&cat=-93&paged=' . $paged);  

                if ( have_posts() ) :

                    /* Start the Loop */
                    while ( have_posts() ) : the_post();

                (content)
                endwhile;
                endif;
                wp_reset_query(); // reset the query 

                the_posts_pagination( array( 'prev_text' => 'prev', 'next_text' => 'next' ) );

This is to have the post from current tag but exclude one category and show 5 post per page. But this query post the navigation doesn't work.

I added also the string for 'paged' but nothing changes.

Can you help me?

  • 2
    search this site for pre_get_posts. you should alter the main query, not create a new query in the template. – Milo Oct 4 '18 at 17:08
  • what means alter main query? I found pre_get_posts in some solutions of this problem but I don't understand how implement it... Can you help me? @Milo – Giulio Oct 4 '18 at 18:09
  • Is there someone that can help me? – Giulio Oct 5 '18 at 14:44
  • I solved.. there was a problem with another plugin.. – Giulio Oct 5 '18 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.