This repository has been archived by the owner on Dec 27, 2022. It is now read-only.
Add support for persisting the Customizer state through form submissions #72
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the Customizer preview, the changes here allow for forms with a
GET
request method to be submitted and for the resultant URL to be loaded in the preview. This fixes a Core enhancement #20714: Theme customizer: Impossible to preview a search results page. The reason for disallowingPOST
requests is that they normally should entail mutating the server state which should be forbidden when using the Customizer, as all changes should flow through Customizer settings and only affected once hitting “Save & Publish”. If a form has aPOST
request method then any submit buttons will have anot-allowed
cursor.Likewise, when previewing the Customizer state on the frontend (when the
customize_snapshot_uuid
query param is present), all forms that haveaction
URLs pointing to the WP instance in the current document will be amended to have acustomize_snapshot_uuid
namedinput
element. In this way, any form submissions done on the frontend will also result in the previewed Customizer state being persisted in the response.