[wp-trac] [WordPress Trac] #53868: Add option to `paginate_links` to apply format on all pages

WordPress Trac noreply at wordpress.org
Tue Aug 3 11:26:08 UTC 2021


#53868: Add option to `paginate_links` to apply format on all pages
--------------------------+-----------------------------
 Reporter:  ntsekouras    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 `paginate_links` doesn't use the provided format when the page is `1`.
 This is great for the main query as it removes the extra query params
 making the URL shorter, but in the case of custom queries is problematic.

 If no additional data is appended via. add args / add fragment, the string
 remains empty at the time of output, which browsers then default it to the
 current page URL.

 The code for this behavior is this: `$link = str_replace( '%_%', 1 == $n ?
 '' : $args['format'], $args['base'] );`

 My proposed solution is to add a new option in `paginate_links` that would
 enforce applying the `format` for all pages, including the first one.

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


More information about the wp-trac mailing list