• Hello,
    I’m having some trouble with my pagination and browsing search result pages.

    Let’s say I’m searching for the word WordPress.

    My URL goes https://www.examplesite.com/?s=wordpress, which is fine.
    But if I want to go to page 2 of my search results I’m met with this URL… https://www.examplesite.com/?s=wordpresspage/2. That’s instead of https://www.examplesite.com/page/2/?s=wordpress.
    They’re in the wrong order. Why is this, and how do I solve this?

    pagination code, at bottom of search.php:

    <!-- #page_nav -->
            <?php
                global $wp_query;
                $total_pages = $wp_query->max_num_pages;
                if ($total_pages > 1){
                    $current_page = max(1, get_query_var('paged'));
                    echo '<div id="page_nav">';
                    echo paginate_links(array(
                    'base' => get_pagenum_link(1) . '%_%',
                    'format' => 'page/%#%',
                    'current' => $current_page,
                    'total' => $total_pages,
                    'show_all'  =>  false,
                    'prev_text' => '? F?reg?ende sida',
                    'next_text' => 'N?sta sida ?',
                    'type' => 'list'
                    ));
                echo '</div>';
                }
            ?>
    <!-- /#page_nav -->

    Hopefully there’s a simple solution out there and I’m just the noob.

    Thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Search pagination URL messed up’ is closed to new replies.