0

I have created a custom search form. That works perfectly.

I have added pagination. That also works (almost) perfectly.

Now if I have the following search query/url

http://domain.com/?s=&ssd=1&spid=home&sex%5B%5D=4

Then the pagination link for the second page is

http://domain.com/page/2/?s&ssd=1&sex%5B0%5D=4#038;ssd=1&sex%5B0%5D=4

This part gets added:

#038;ssd=1&sex%5B0%5D=4

But I have no clue as to why.

This is my pagination function:

function get_paging() {
    global $wp_query;

    if ( $wp_query->max_num_pages < 2 ) {
        return false;
    }

    $big  = 999999999; 
    $args = array(
        'base'      => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
        'format'    => '/page/%#%',
        'total'     => $wp_query->max_num_pages,
        'current'   => max( 1, get_query_var( 'paged' ) ),
        'show_all'  => false,
        'end_size'  => 3,
        'mid_size'  => 2,
        'prev_next' => true,
        'prev_text' => __( '&laquo; Previous', 'sexdates' ),
        'next_text' => __( 'Next &raquo;', 'sexdates' ),
        'type'      => 'list',
    );

    return sprintf( '<div class="paginator">%s</div>', paginate_links( $args ) );
}

I think it's something real easy which I have overlooked but I wouldn't know what causes it. I've tried adding query vars to the pagination but this didn't work either.

0

As I wrote I expected it to be something I overlooked and it was.

If you replace

esc_url( get_pagenum_link( $big ) )

with

html_entity_decode( get_pagenum_link( $big ) )

it does what it needs to do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.