WP_Customize_Widgets::filter_option_sidebars_widgets_for_theme_switch() WordPress Method

The WP_Customize_Widgets::filter_option_sidebars_widgets_for_theme_switch() Wordpress method is used to filter the sidebars widgets for a theme switch. This is useful for switching between themes that have different sidebar widgets.

WP_Customize_Widgets::filter_option_sidebars_widgets_for_theme_switch( array $sidebars_widgets ) #

Filters sidebars_widgets option for theme switch.


Description

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.

Top ↑

See also


Top ↑

Parameters

$sidebars_widgets

(array)(Required)


Top ↑

Return

(array)


Top ↑

Source

File: wp-includes/class-wp-customize-widgets.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;
	}

Top ↑

Changelog

Changelog
VersionDescription
3.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More