Support » Fixing WordPress » Show all posts without page navigation in archive.php

  • Resolved Tunghsiao Liu

    (@sparanoid)


    Hi all, I tried to display all posts with without pages in archive.php. I used posts_per_page=-1 but it displayed all the posts on my site, anyone has good ideas?

Viewing 1 replies (of 1 total)
  • It sounds like you did not retain the original query arguments. Here is the way to override the pagination while keeping the original arguments:

    global $wp_query;
    query_posts(
        array_merge(
            $wp_query->query,
            array('posts_per_page' => -1),
        )
    );
Viewing 1 replies (of 1 total)
  • The topic ‘Show all posts without page navigation in archive.php’ is closed to new replies.