WP_Customize_Widgets::start_dynamic_sidebar()publicWP 4.5.0

Begins keeping track of the current sidebar being rendered.

Insert marker before widgets are rendered in a dynamic sidebar.

Method of the class: WP_Customize_Widgets{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_Customize_Widgets = new WP_Customize_Widgets();
$WP_Customize_Widgets->start_dynamic_sidebar( $index );
$index(int|string) (required)
Index, name, or ID of the dynamic sidebar.

Changelog

Since 4.5.0 Introduced.

WP_Customize_Widgets::start_dynamic_sidebar() code WP 6.4.3

public function start_dynamic_sidebar( $index ) {
	array_unshift( $this->current_dynamic_sidebar_id_stack, $index );
	if ( ! isset( $this->sidebar_instance_count[ $index ] ) ) {
		$this->sidebar_instance_count[ $index ] = 0;
	}
	$this->sidebar_instance_count[ $index ] += 1;
	if ( ! $this->manager->selective_refresh->is_render_partials_request() ) {
		printf( "\n<!--dynamic_sidebar_before:%s:%d-->\n", esc_html( $index ), (int) $this->sidebar_instance_count[ $index ] );
	}
}