Make WordPress Core

Opened 4 years ago

Last modified 3 years ago

#42163 new defect (bug)

Customize: Add support for previewing requests made via the Fetch API

Reported by: westonruter Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.7
Component: Customize Keywords: has-patch needs-testing
Focuses: javascript Cc:


The Customizer preview supports applying the customized state to Ajax requests via jQuery.prefilterAjax. However, if a frontend is not using jQuery but rather the Fetch API then the customized state will not be injected into the request in order to have the customized state applied to the response. In the same way that customize-preview.js is wrapping history.replaceState() and history.pushState() to inject the customized state, we should also wrap fetch() to do the same. We may also want to do this for XMLHttpRequest as well.

Change History (4)

#1 @westonruter
4 years ago

  • Keywords has-patch needs-testing added
  • Version set to 4.7

Feature plugin for testing: https://github.com/xwp/wp-customize-preview-fetch-api

Pull requests welcome. There are some outstanding todos for supporting the passing of Request into fetch() as well as handling of Headers.

#2 @johnbillion
4 years ago

  • Milestone changed from 4.9.1 to 5.0

#3 @johnbillion
3 years ago

  • Milestone changed from 5.0 to 5.1

#4 @pento
3 years ago

  • Milestone changed from 5.1 to Future Release
Note: See TracTickets for help on using tickets.