[wp-trac] [WordPress Trac] #31939: paginate_links() - incorrect links on return to the first page

WordPress Trac noreply at wordpress.org
Thu Apr 9 10:06:13 UTC 2015


#31939: paginate_links() - incorrect links on return to the first page
--------------------------+------------------------------
 Reporter:  bobbingwide   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Themes        |     Version:  4.1.1
 Severity:  normal        |  Resolution:
 Keywords:  2nd-opinion   |     Focuses:
--------------------------+------------------------------
Changes (by bobbingwide):

 * keywords:   => 2nd-opinion


Comment:

 OK, I have a workaround.

 I need to change the value of REQUEST_URI in $_SERVER to remove my special
 query arg, otherwise
 the new code in 4.1.1 will find it as the pagenum_link and add it back
 into the add_args array...
 even though I've specifically passed add_args=>false.

 {{{
 function bw_navi_paginate_links( $id, $page, $pages ) {
   $string = remove_query_arg( "bwscid$id" );
   $_SERVER['REQUEST_URI'] = $string;
   $base = add_query_arg( "bwscid$id", "%_%" );
   $format = "%#%";
   $args = array( "base" => $base
                , "format" => $format
                , "total" => $pages
                , "current" => $page
                , "before_page_number" => "["
                , "after_page_number" => "]"
                , "add_args" => false
                );
   $links = paginate_links( $args );
   e( $links );
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31939#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list