WP-PageNavi plugin doesn’t work with multiple pages of search results

I’m using Dilectio theme and WP-PageNavi plugin. The plugin creates links to multiple pages perfectly on every page except for the search results page.

For example, when I search for the keyword “lamp,” it indicates there are 2 pages of search results. When I click on page 2, it takes me to page 2 of my blog, not page 2 of the search results. Can someone please help me fix this?

Related posts

Leave a Reply

2 comments

  1. I discovered that the problem was in my theme’s searchform.php file. I changed the form method from “post” to “get.” Now search queries show up in the url address.
    Before:
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    After:
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
    Problem solved.

  2. Dilectio theme comes with an old version of WP-PageNavi plugin embedded in its functions.php file, so the best thing you can do is just remove the wp_pagenavi function form the functions.php, install the plugin and you should be set.