WP_Customize_Widgets::preview_sidebars_widgets()publicWP 3.9.0

When previewing, ensures the proper previewing widgets are used.

Because wp_get_sidebars_widgets() gets called early at {@see 'init' } (via wp_convert_widget_settings()) and can set global variable $_wp_sidebars_widgets to the value of `get_option( sidebars_widgets before the Customizer preview filter is added, it has to be reset after the filter has been added.

Метод класса: WP_Customize_Widgets{}

Хуков нет.




$WP_Customize_Widgets = new WP_Customize_Widgets();
$WP_Customize_Widgets->preview_sidebars_widgets( $sidebars_widgets );
$sidebars_widgets(массив) (обязательный)
List of widgets for the current sidebar.

Список изменений

С версии 3.9.0 Введена.

Код WP_Customize_Widgets::preview_sidebars_widgets() WP 6.5.3

public function preview_sidebars_widgets( $sidebars_widgets ) {
	$sidebars_widgets = get_option( 'sidebars_widgets', array() );

	unset( $sidebars_widgets['array_version'] );
	return $sidebars_widgets;