[wp-trac] [WordPress Trac] #52998: Add a filter to paginate_links to allow bypassing merging query params

WordPress Trac noreply at wordpress.org
Tue Apr 5 12:56:02 UTC 2022

#52998: Add a filter to paginate_links to allow bypassing merging query params
 Reporter:  jonoaldersonwp  |       Owner:  (none)
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  General         |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  seo             |     Focuses:  performance

Comment (by antonvlasenko):

 > Alternatively:
 > The filter could define a list of allowed/expected query params, or;
 > The filter could restrict valid params to only include registered query

 I like the alternative approach you described above.
 IMO allowing to short circuit/bypass the query logic may not be enough.  A
 more flexible approach is better as it will enable fine-tuning the query
 parameters depending on the needs of a particular plugin.
 Speaking of implementation, I'd add 2 filters:
 1. The first filter would be right before this line:
 template.php#L4215; it would allow filtering `$args['add_args']` values.
 2. The second filter would be before this line:
 template.php#L4212. The second filter would allow filtering
 `$url_query_args`  variable. It would allow to control which values get
 merged to the $args[‘add_args’] array.

Ticket URL: <https://core.trac.wordpress.org/ticket/52998#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list