diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 8da032d183..475608efa7 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -1773,7 +1773,7 @@ function upgrade_330() { // Intentional fall-through to upgrade to the next version. case 2: - $sidebars_widgets = sync_registered_widgets(); + $sidebars_widgets = retrieve_widgets(); $sidebars_widgets['array_version'] = 3; update_option( 'sidebars_widgets', $sidebars_widgets ); } diff --git a/wp-admin/widgets-form.php b/wp-admin/widgets-form.php index 9284f734e6..df4efdba90 100644 --- a/wp-admin/widgets-form.php +++ b/wp-admin/widgets-form.php @@ -118,7 +118,7 @@ register_sidebar( ) ); -sync_registered_widgets(); +retrieve_widgets(); // We're saving a widget without JS. if ( isset( $_POST['savewidget'] ) || isset( $_POST['removewidget'] ) ) { diff --git a/wp-includes/class-wp-customize-widgets.php b/wp-includes/class-wp-customize-widgets.php index 264b502e9d..c96773b139 100644 --- a/wp-includes/class-wp-customize-widgets.php +++ b/wp-includes/class-wp-customize-widgets.php @@ -275,9 +275,9 @@ final class WP_Customize_Widgets { add_filter( 'customize_value_old_sidebars_widgets_data', array( $this, 'filter_customize_value_old_sidebars_widgets_data' ) ); $this->manager->set_post_value( 'old_sidebars_widgets_data', $this->old_sidebars_widgets ); // Override any value cached in changeset. - // sync_registered_widgets() looks at the global $sidebars_widgets. + // retrieve_widgets() looks at the global $sidebars_widgets. $sidebars_widgets = $this->old_sidebars_widgets; - $sidebars_widgets = sync_registered_widgets( 'customize' ); + $sidebars_widgets = retrieve_widgets( 'customize' ); add_filter( 'option_sidebars_widgets', array( $this, 'filter_option_sidebars_widgets_for_theme_switch' ), 1 ); // Reset global cache var used by wp_get_sidebars_widgets(). unset( $GLOBALS['_wp_sidebars_widgets'] ); @@ -287,7 +287,7 @@ final class WP_Customize_Widgets { * Filters old_sidebars_widgets_data Customizer setting. * * When switching themes, filter the Customizer setting old_sidebars_widgets_data - * to supply initial $sidebars_widgets before they were overridden by sync_registered_widgets(). + * to supply initial $sidebars_widgets before they were overridden by retrieve_widgets(). * The value for old_sidebars_widgets_data gets set in the old theme's sidebars_widgets * theme_mod. * @@ -305,7 +305,7 @@ final class WP_Customize_Widgets { /** * Filters sidebars_widgets option for theme switch. * - * When switching themes, the sync_registered_widgets() function is run when the Customizer initializes, + * When switching themes, the retrieve_widgets() function is run when the Customizer initializes, * and then the new sidebars_widgets here get supplied as the default value for the sidebars_widgets * option. * diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php index 24f13814cf..2aad57ad54 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php @@ -98,7 +98,7 @@ class WP_REST_Sidebars_Controller extends WP_REST_Controller { * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */ public function get_items( $request ) { - sync_registered_widgets(); + retrieve_widgets(); $data = array(); foreach ( wp_get_sidebars_widgets() as $id => $widgets ) { @@ -137,7 +137,7 @@ class WP_REST_Sidebars_Controller extends WP_REST_Controller { * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */ public function get_item( $request ) { - sync_registered_widgets(); + retrieve_widgets(); $sidebar = $this->get_sidebar( $request['id'] ); diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php index dea8ed3ac0..4c54620f50 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php @@ -109,7 +109,7 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller { * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */ public function get_items( $request ) { - sync_registered_widgets(); + retrieve_widgets(); $prepared = array(); @@ -151,7 +151,7 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller { * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */ public function get_item( $request ) { - sync_registered_widgets(); + retrieve_widgets(); $widget_id = $request['id']; $sidebar_id = wp_find_widgets_sidebar( $widget_id ); @@ -237,7 +237,7 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller { global $wp_widget_factory; /* - * sync_registered_widgets() contains logic to move "hidden" or "lost" widgets to the + * retrieve_widgets() contains logic to move "hidden" or "lost" widgets to the * wp_inactive_widgets sidebar based on the contents of the $sidebars_widgets global. * * When batch requests are processed, this global is not properly updated by previous @@ -248,7 +248,7 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller { */ wp_get_sidebars_widgets(); - sync_registered_widgets(); + retrieve_widgets(); $widget_id = $request['id']; $sidebar_id = wp_find_widgets_sidebar( $widget_id ); @@ -313,7 +313,7 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller { global $wp_widget_factory, $wp_registered_widget_updates; /* - * sync_registered_widgets() contains logic to move "hidden" or "lost" widgets to the + * retrieve_widgets() contains logic to move "hidden" or "lost" widgets to the * wp_inactive_widgets sidebar based on the contents of the $sidebars_widgets global. * * When batch requests are processed, this global is not properly updated by previous @@ -324,7 +324,7 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller { */ wp_get_sidebars_widgets(); - sync_registered_widgets(); + retrieve_widgets(); $widget_id = $request['id']; $sidebar_id = wp_find_widgets_sidebar( $widget_id ); diff --git a/wp-includes/theme.php b/wp-includes/theme.php index e58719e641..384c056404 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -805,7 +805,7 @@ function switch_theme( $stylesheet ) { add_option( "theme_mods_$stylesheet", $default_theme_mods ); } else { /* - * Since sync_registered_widgets() is called when initializing a theme in the Customizer, + * Since retrieve_widgets() is called when initializing a theme in the Customizer, * we need to remove the theme mods to avoid overwriting changes made via * the Customizer when accessing wp-admin/widgets.php. */ diff --git a/wp-includes/version.php b/wp-includes/version.php index bfa59a684a..6db5b347da 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-alpha-51790'; +$wp_version = '5.9-alpha-51791'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index 4f15917345..61caf6af56 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -1251,30 +1251,13 @@ function _wp_sidebars_changed() { $sidebars_widgets = wp_get_sidebars_widgets(); } - sync_registered_widgets( true ); + retrieve_widgets( true ); } /** - * Do not use, deprecated. - * - * Use sync_registered_widgets() instead. + * Look for "lost" widgets, this has to run at least on each theme change. * * @since 2.8.0 - * @deprecated 5.8.1 Use sync_registered_widgets() - * @see sync_registered_widgets() - * - * @param string|bool $theme_changed - * @return array - */ -function retrieve_widgets( $theme_changed = false ) { - return sync_registered_widgets( $theme_changed ); -} - -/** - * Looks for "lost" widgets and Updates widgets-to-sidebars allocation. - * This has to run at least on each theme change. - * - * @since 5.8.1 * * @global array $wp_registered_sidebars Registered sidebars. * @global array $sidebars_widgets @@ -1284,7 +1267,7 @@ function retrieve_widgets( $theme_changed = false ) { * of 'customize' defers updates for the Customizer. * @return array Updated sidebars widgets. */ -function sync_registered_widgets( $theme_changed = false ) { +function retrieve_widgets( $theme_changed = false ) { global $wp_registered_sidebars, $sidebars_widgets, $wp_registered_widgets; $registered_sidebars_keys = array_keys( $wp_registered_sidebars );