Title: Pagination Problem
Last modified: September 1, 2016

---

# Pagination Problem

 *  Resolved [wrxbuzz](https://wordpress.org/support/users/wrxbuzz/)
 * (@wrxbuzz)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/pagination-problem-78/)
 * Hi Guys,
 * I’m using a custom pagination system and when trying to pass variables through
   my URL the my HREF’s get scrambled. Any idea how to fix that?
 * When clicking on the “Next” pagination page I get:
    `/perfumes/?cat=women-testerspage/
   2`
 * instead of this:
    `/perfumes/page/2/?cat=women-testers`
 * I’m guessing its something to do with reformatting this code, but I’m not sure
   how:
 *     ```
       $pagination_args = array(
           'base'            => get_pagenum_link(1) . '%_%',
           'format'          => 'page/%#%',
           'total'           => $numpages,
           'current'         => $paged,
           'show_all'        => False,
           'end_size'        => 1,
           'mid_size'        => $pagerange,
           'prev_next'       => True,
           'prev_text'       => __('&laquo;'),
           'next_text'       => __('&raquo;'),
           'type'            => 'plain',
           'add_args'        => false,
           'add_fragment'    => ''
         );
   
         $paginate_links = paginate_links($pagination_args);
       ```
   
 * Here’s my pagination code from functions.php: [http://pastebin.com/9ueAg6sn](http://pastebin.com/9ueAg6sn)
 * Thanks for the help!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [wrxbuzz](https://wordpress.org/support/users/wrxbuzz/)
 * (@wrxbuzz)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/pagination-problem-78/#post-7508052)
 * Self-Solved!
 * I replaced:
 *     ```
       'base'            => get_pagenum_link(1) . '%_%',
           'format'          => 'page/%#%',
           'total'           => $numpages,
           'current'         => $paged,
       ```
   
 * With:
 *     ```
       'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
           'format' => '?paged=%#%',
           'total' => $numpages,
           'current' => $paged,
       ```
   
 *  [aizwallenstein](https://wordpress.org/support/users/aizwallenstein/)
 * (@aizwallenstein)
 * [10 years ago](https://wordpress.org/support/topic/pagination-problem-78/#post-7508366)
 * hi!
    What’s your $big? I got the same problem and I don’t get how your code is
   working….

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Pagination Problem’ is closed to new replies.

## Tags

 * [pagination](https://wordpress.org/support/topic-tag/pagination/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * 2 replies
 * 2 participants
 * Last reply from: [aizwallenstein](https://wordpress.org/support/users/aizwallenstein/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/pagination-problem-78/#post-7508366)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
