Title: contentoptional's Replies | WordPress.org

---

# contentoptional

  [  ](https://wordpress.org/support/users/contentoptional/)

 *   [Profile](https://wordpress.org/support/users/contentoptional/)
 *   [Topics Started](https://wordpress.org/support/users/contentoptional/topics/)
 *   [Replies Created](https://wordpress.org/support/users/contentoptional/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/contentoptional/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/contentoptional/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/contentoptional/engagements/)
 *   [Favorites](https://wordpress.org/support/users/contentoptional/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [using posts_per_page in search form not working](https://wordpress.org/support/topic/using-posts_per_page-in-search-form-not-working/)
 *  [contentoptional](https://wordpress.org/support/users/contentoptional/)
 * (@contentoptional)
 * [19 years, 8 months ago](https://wordpress.org/support/topic/using-posts_per_page-in-search-form-not-working/#post-403954)
 * Hi,
 * I had a very similar problem, in that I wanted to have my index and archive pages
   show only one post per page, but I wanted all of my search results to show up
   on one page. After a lot of failure and searching, I found the solution in [somebody else’s problem](http://wordpress.org/support/topic/75196):
 * Instead of changing the search form, your client can change the search results
   page. Just before the Loop, add the following code:
 * <?php
    $wp_query->query_vars[“posts_per_page”] = 5; $wp_query->get_posts(); ?
   >
 * My own problem was that I was using <?php query_posts(“posts_per_page=5”); ?>.
   As the user on the other topic explains, using query_posts() restarts the query,
   whereas the other method above merely adds the post_per_page variable to the 
   existing query (which is a search query in the case of the search results page).
 * I hope this helps!

Viewing 1 replies (of 1 total)