[wp-trac] [WordPress Trac] #3308: add_query_arg() removes blank query vars

WordPress Trac noreply at wordpress.org
Sun Feb 11 08:25:33 UTC 2024


#3308: add_query_arg() removes blank query vars
--------------------------+---------------------
 Reporter:  markjaquith   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  2.1
Component:  General       |     Version:  2.1
 Severity:  normal        |  Resolution:  fixed
 Keywords:                |     Focuses:
--------------------------+---------------------

Comment (by sinedvlo1):

 Why does `add_query_arg()` remove blank query variables? This behavior
 results in the removal of existing but blank query arguments, which can be
 problematic. I propose updating `remove_query_arg()` to use `FALSE`
 instead of a blank string to address this issue. This change will allow
 blank query variables to be preserved, ensuring better preservation of the
 existing query string. Additionally, this update will ensure that
 `?foo&bar=test` is preserved as `?foo=&bar=test`. Overall, these changes
 will improve the handling of query strings.

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


More information about the wp-trac mailing list