WordPress at a glance
функция не описана

WP_Customize_Widgets::parse_widget_id() public WP 3.9.0

Converts a widget ID into its id_base and number components.

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

Хуков нет.

Возвращает

Array. Array containing a widget's id_base and number components.

Использование

$WP_Customize_Widgets = new WP_Customize_Widgets();
$WP_Customize_Widgets->parse_widget_id( $widget_id );
$widget_id(string) (required)
Widget ID.

Changelog

Since 3.9.0 Introduced.

Код WP_Customize_Widgets::parse_widget_id() WP 5.5.1

<?php
public function parse_widget_id( $widget_id ) {
	$parsed = array(
		'number'  => null,
		'id_base' => null,
	);

	if ( preg_match( '/^(.+)-(\d+)$/', $widget_id, $matches ) ) {
		$parsed['id_base'] = $matches[1];
		$parsed['number']  = intval( $matches[2] );
	} else {
		// Likely an old single widget.
		$parsed['id_base'] = $widget_id;
	}
	return $parsed;
}