[wp-trac] [WordPress Trac] #44269: Add optional parameter $merge_args into paginate_links function

WordPress Trac noreply at wordpress.org
Tue May 29 21:02:59 UTC 2018


#44269: Add optional parameter $merge_args into paginate_links function
----------------------------+-----------------------------
 Reporter:  andrepoandrade  |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  General         |    Version:  4.9.5
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 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
 <?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 ) );
         }
     }
 }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44269>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list