wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



wp_find_widgets_sidebar › WordPress Function

Da5.8.0
Deprecaton/a
wp_find_widgets_sidebar ( $widget_id )
Parametri:
  • (string) $widget_id The widget ID to look for.
    Richiesto:
Ritorna:
  • (string|null) The found sidebar's ID, or null if it was not found.
Definito a:
Codex:

Finds the sidebar that a given widget belongs to.



Sorgenti

function wp_find_widgets_sidebar( $widget_id ) {
	foreach ( wp_get_sidebars_widgets() as $sidebar_id => $widget_ids ) {
		foreach ( $widget_ids as $maybe_widget_id ) {
			if ( $maybe_widget_id === $widget_id ) {
				return (string) $sidebar_id;
			}
		}
	}

	return null;
}