WordPress.org

Make WordPress Core

Opened 7 weeks ago

#44269 new defect (bug)

Add optional parameter $merge_args into paginate_links function

Reported by: andrepoandrade Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.5
Component: General Keywords:
Focuses: Cc:

Description

I'm passing a query arg that exists on args in current url, but the value passed by parameter is different. What happens is that the value of query arg passed as tabname is overwritten by value into current url arg.

I suggest an optional parameter called $merge_args and default value as true, in this way, all necessary query args to build pagination links should be passed by add_args and nothing is overwrite.

<?php
function paginate_links( $args = '', $merge_args = true ) {
...
...
    if ( isset( $url_parts[1] ) ) {
        ...
        ...
        if($merge_args)
        {
            $args['add_args'] = array_merge( $args['add_args'], urlencode_deep( $url_query_args ) );
        }
    }
}

Attachments (1)

general-template.php (135.8 KB) - added by andrepoandrade 7 weeks ago.
File general-template.php with modified paginate_links function

Download all attachments as: .zip

Change History (1)

@andrepoandrade
7 weeks ago

File general-template.php with modified paginate_links function

Note: See TracTickets for help on using tickets.