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


Then the pagination link for the second page is


This part gets added:


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.

1 Answer 1


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

If you replace

esc_url( get_pagenum_link( $big ) )


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 and acknowledge you have read our privacy policy.

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