Un motore di ricerca WordPress per sviluppatori e autori di temi



_wp_remove_unregistered_widgets ›

Da4.9.0
Deprecaton/a
_wp_remove_unregistered_widgets ( $sidebars_widgets, $whitelist = array() )
Parametri: (2)
  • (array) $sidebars_widgets List of sidebars and their widget instance IDs.
    Richiesto:
  • (array) $whitelist Optional. List of widget IDs to compare against. Default: Registered widgets.
    Richiesto: No
    Default: array()
Ritorna:
  • (array) Sidebars with whitelisted widgets.
Definito a:
Codex:

Compares a list of sidebars with their widgets against a whitelist.



Sorgenti

function _wp_remove_unregistered_widgets( $sidebars_widgets, $whitelist = array() ) {
	if ( empty( $whitelist ) ) {
		$whitelist = array_keys( $GLOBALS['wp_registered_widgets'] );
	}

	foreach ( $sidebars_widgets as $sidebar => $widgets ) {
		if ( is_array( $widgets ) ) {
			$sidebars_widgets[ $sidebar ] = array_intersect( $widgets, $whitelist );
		}
	}

	return $sidebars_widgets;
}