WP_Customize_Widgets::sanitize_sidebar_widgets_js_instance() WordPress Method

The WP_Customize_Widgets::sanitize_sidebar_widgets_js_instance() method is used to sanitize the sidebar widgets within a Customizer JS instance.

WP_Customize_Widgets::sanitize_sidebar_widgets_js_instance( array $widget_ids ) #

Strips out widget IDs for widgets which are no longer registered.


Description

One example where this might happen is when a plugin orphans a widget in a sidebar upon deactivation.


Top ↑

Parameters

$widget_ids

(array)(Required)List of widget IDs.


Top ↑

Return

(array) Parsed list of widget IDs.


Top ↑

Source

File: wp-includes/class-wp-customize-widgets.php

	public function sanitize_sidebar_widgets_js_instance( $widget_ids ) {
		global $wp_registered_widgets;
		$widget_ids = array_values( array_intersect( $widget_ids, array_keys( $wp_registered_widgets ) ) );
		return $widget_ids;
	}

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