Wordpress website. There is a code:

<?php query_posts("cat=18"); while (have_posts()) : the_post(); get_template_part( "books-cat"); endwhile; ?> <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?> 

The page displays posts and pagination. This pagination does not work, namely when you go to the second page, the address changes, and the posts are the same, i.e. from the first page.

How to make pagination work?

    1 answer 1

    How to make pagination work?

    Throw out query_posts as obsolete and potentially dangerous, and use wp_query or get_posts .

    See additional in Russian wp_query , get_posts .

    • Ok, I just changed it to wp_query. But the problem persists - PC Tea
    • If in that code it is easy to change query_posts to wp_query, but it is unlikely that something will turn out. See on vp-kama - there is written about paginatsyu and examples are given. In general, there is no content output in the code, but connecting the template .. a strange kind of idea. - SeVlad