WordPress at a glance
function is not described

WP_Customize_Widgets::filter_option_sidebars_widgets_for_theme_switch() public WP 3.9.0

Filters sidebars_widgets option for theme switch.

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.

{} It's a method of the class: WP_Customize_Widgets{}

No Hooks.

Return

Array.

Usage

$WP_Customize_Widgets = new WP_Customize_Widgets();
$WP_Customize_Widgets->filter_option_sidebars_widgets_for_theme_switch( $sidebars_widgets );
$sidebars_widgets(array) (required)

Notes

  • See: WP_Customize_Widgets::handle_theme_switch()
  • Global. Array. $sidebars_widgets

Changelog

Since 3.9.0 Introduced.

Code of WP_Customize_Widgets::filter_option_sidebars_widgets_for_theme_switch() WP 5.5.1

<?php
public function filter_option_sidebars_widgets_for_theme_switch( $sidebars_widgets ) {
	$sidebars_widgets                  = $GLOBALS['sidebars_widgets'];
	$sidebars_widgets['array_version'] = 3;
	return $sidebars_widgets;
}