[wp-trac] [WordPress Trac] #44499: add_query_arg function doesn't remove the empty '?' when an anchor exists

WordPress Trac noreply at wordpress.org
Tue Nov 16 18:12:08 UTC 2021


#44499: add_query_arg function doesn't remove the empty '?' when an anchor exists
---------------------------------------------+-----------------------------
 Reporter:  benjamin.anakena                 |       Owner:  hellofromTonya
     Type:  defect (bug)                     |      Status:  assigned
 Priority:  normal                           |   Milestone:  5.9
Component:  General                          |     Version:  4.9.6
 Severity:  minor                            |  Resolution:
 Keywords:  has-patch has-unit-tests commit  |     Focuses:
---------------------------------------------+-----------------------------
Changes (by hellofromTonya):

 * keywords:  has-patch has-unit-tests => has-patch has-unit-tests commit


Comment:

 While the `add_query_arg()` does not remove the unneeded `?` when there
 are no query args, it works in each browser tested. Granted it seems odd
 to leave `?` when it's not needed. But I wonder: Is there's a browser or
 device where this does not work?

 For backend correctness, it makes sense to remove the unneeded `?`
 character. This can help with further processing where that character is
 not expected and guard Core against changes in browsers or incompatibility
 between apps and browsers.

 [https://github.com/WordPress/wordpress-develop/pull/1902 PR 1902] is
 ready for `commit`.

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


More information about the wp-trac mailing list