Problem with paging wordpress (returns 404)

1

I'm doing the index of a site and in it I do a search of the posts, alias several searches, and the last of them has pagination that is the last registered posts.

I'm doing the query as follows:

<?php query_posts(array('posts_per_page' => 2, 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1), 'meta_query' => array(array('key' => 'destaque', 'value' => 'on', 'compare' => 'NOT EXISTS')))); ?>

Then after the while I put:

<?php echo paginate_links(); ?>

It shows the two page posts and pagination links, but it goes to 404. What can it be?

    
asked by anonymous 13.04.2015 / 18:02

2 answers

1

If you make multiple queries, be sure to clear the WP query, like this:

<?php wp_reset_query(); ?>

According to the WP documentation , this method should be called whenever you invoke query_posts() .

If you're working with Custom Posts, I also recommend that you flush your permalinks rules (just change to some other one and then go back to what you were). At times, the 404 may occur because of some conflict in those rules.

    
14.04.2015 / 19:19
0

I believe that through the Wordpress admin panel itself you can correct this problem.

First go to Settings > Read, and change the value of the "Blog pages show maximum" field to 2, then save the changes.

ThengotoSettings>PermanentLinks,onthispagejustclickonSaveChangessothatWordpress"resumes" the whole structure of links.

    
08.05.2016 / 06:54