Make WordPress Core

Opened 2 years ago

#55587 new defect (bug)

Customize preview removes URL query parameters of the same name and keeps only the last one

Reported by: xparham's profile xParham Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version:
Component: Customize Keywords:
Focuses: Cc:

Description

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=...

Change History (0)

Note: See TracTickets for help on using tickets.