WordPress at a glance
function is not described

WP_Customize_Widgets::sanitize_sidebar_widgets() public WP 3.9.0

Ensures sidebar widget arrays only ever contain widget IDS.

Used as the 'sanitize_callback' for each $sidebars_widgets setting.

{} It's a method of the class: WP_Customize_Widgets{}

No Hooks.

Return

String[]. Array of sanitized widget IDs.

Usage

$WP_Customize_Widgets = new WP_Customize_Widgets();
$WP_Customize_Widgets->sanitize_sidebar_widgets( $widget_ids );
$widget_ids(string[]) (required)
Array of widget IDs.

Changelog

Since 3.9.0 Introduced.

Code of WP_Customize_Widgets::sanitize_sidebar_widgets() WP 5.5.1

<?php
public function sanitize_sidebar_widgets( $widget_ids ) {
	$widget_ids           = array_map( 'strval', (array) $widget_ids );
	$sanitized_widget_ids = array();
	foreach ( $widget_ids as $widget_id ) {
		$sanitized_widget_ids[] = preg_replace( '/[^a-z0-9_\-]/', '', $widget_id );
	}
	return $sanitized_widget_ids;
}