Problem with wordpress paging (returns 404)

Asked

Viewed 496 times

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 one has pagination that is the last posts registered.

I’m doing the consultation 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')))); ?>

There after the while I lay:

<?php echo paginate_links(); ?>

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

  • there is a Stack Exchange only for wordpress ! http://wordpress.stackexchange.com/

2 answers

1

If you make multiple queries, don’t forget to reset the WP query this way:

<?php wp_reset_query(); ?>

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

If you are working with Custom Posts, I also recommend that you flush your permalink rules (just switch to some other and then go back to what you were). Sometimes the 404 may occur due to some conflict in these rules.

0

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

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

inserir a descrição da imagem aqui

Then go to Settings > Permanent Links, on this page just click Save Changes so that Wordpress "redo" the entire link structure.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.