[wp-trac] [WordPress Trac] #55587: Customize preview removes URL query parameters of the same name and keeps only the last one

WordPress Trac noreply at wordpress.org
Mon Apr 18 17:41:22 UTC 2022


#55587: Customize preview removes URL query parameters of the same name and keeps
only the last one
--------------------------+-----------------------------
 Reporter:  xParham       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Customize     |    Version:
 Severity:  major         |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 It seems that when the customizer is rebuilding some of the URLs on the
 page if there are multiple query parameters of the same name/key (an
 array) in the URL, it only keeps the last one and removes the others.

 For example, while in Customizer, if you add a menu item with a custom
 link of `/my-page/?myvar[]=A&myvar[]=B` the URL of the menu for the
 preview is rewritten to `/my-
 page/?myvar[]=B&customize_changeset_uuid=...`, losing `myvar[]=A`.

 This is also happening to the URL of the page itself (the preview's IFRAME
 src) when for example there is a form with a multi-select field submitted.
 Assume we have the form below on /my-page/:

 {{{
     <form method="get" action="/my-page/">
           <select name="myfield[]" multiple="multiple">
             <option value="A">A</option>
             <option value="B">B</option>
             <option value="C">C</option>
             <option value="D">D</option>
           </select>
           <input type="submit" value="Apply Filters">
     </form>
 }}}

 If you select A and B and C and submit the form, it is expected that that
 page refreshes with the new URL of `/my-
 page/?myfield[]=A&myfield[]=B&myfield[]=C&customize_changeset_uuid=...`,
 however, I am seeing the following URL instead with the A and B values
 lost in the preview's IFRAME src: `/my-
 page/?myfield[]=C&customize_changeset_uuid=...`

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


More information about the wp-trac mailing list