Go to file
Dominik Schilling (ocean90) ca5db69c31 Customize: Harden assignment of Customizer settings transports for selective refreshable widgets
Theme support for `customize-selective-refresh-widgets` can be added _after_ the logic for registering the settings for incoming widgets that have been changed. This is due to themes adding the theme support in `after_setup_theme` which is also the action where `WP_Customize_Widgets::register_settings()` is called. If these both happen at priority 10, which one is called first depends on which one was added first. The other issue is that at the time that `WP_Customize_Widgets::register_settings()` is called at `after_setup_theme`, it is called before `widgets_init` and thus no widgets are yet registered. This means that any settings registered at this point will always have a `refresh` transport even if the theme supports `customize-selective-refresh-widgets`, since the `WP_Widget` instance is not visible yet to see if it supports selective refresh.

The fix: Defer `WP_Customize_Widgets::register_settings()` from `after_setup_theme` to `widgets_init` at priority 95 when the widget objects have all been registered. Also, ensure that the preview filter for `sidebars_widgets` is added before the sidebars are iterated for adding the controls.

Props westonruter.
Fixes #36389.

git-svn-id: https://develop.svn.wordpress.org/trunk@37166 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-07 20:58:56 +00:00
src Customize: Harden assignment of Customizer settings transports for selective refreshable widgets 2016-04-07 20:58:56 +00:00
tests Customize: Harden assignment of Customizer settings transports for selective refreshable widgets 2016-04-07 20:58:56 +00:00
tools/i18n i18n tools: In StringExtractor don't strip slashes from URLs. 2016-02-29 20:44:31 +00:00
.editorconfig Use HTTPS URLs for codex.wordpress.org. 2015-04-12 21:28:58 +00:00
.gitignore Remove accidental .svn addition to .gitignore 2015-12-12 18:26:22 +00:00
.jshintrc Build: Prevent non-breaking spaces from accidentally being inserted into JavaScript files. 2015-11-12 12:04:55 +00:00
.travis.yml Travis CI: Allow to cache the node_modules directory. 2016-03-22 21:49:36 +00:00
Gruntfile.js Build Tools: Rename the precommit:core task to precommit:base for clarification. 2016-03-10 20:13:29 +00:00
package.json Bump grunt-contrib-qunit ~0.7.0 → ~1.1.0 2016-03-16 17:53:51 +00:00
phpunit.xml.dist Unit Tests: add SpeedTrapListener to phpunit/includes and add the config node to phpunit.xml.dist. 2015-10-16 00:27:28 +00:00
wp-cli.yml Remove debug mode from WP-CLI by default, as it now outputs too much debugging information to be of use during normal development. 2015-11-28 18:36:06 +00:00
wp-config-sample.php Lightly clean up and improve inline documentation in wp-config-sample.php. 2015-05-10 00:05:30 +00:00
wp-tests-config-sample.php Unit Tests: Correct comment in wp-tests-config-sample.php. 2016-01-21 20:24:12 +00:00