wp_parse_widget_id() – Converts a widget ID into its id_base and number components.
You appear to be a bot. Output may be restricted
Description
Converts a widget ID into its id_base and number components.
Usage
$array = wp_parse_widget_id( $id );
Parameters
- $id
- ( string ) required – Widget ID.
Returns
array Array containing a widget's id_base and number components.
Source
File name: wordpress/wp-includes/widgets.php
Lines:
1 to 13 of 13
function wp_parse_widget_id( $id ) { $parsed = array(); if ( preg_match( '/^(.+)-(\d+)$/', $id, $matches ) ) { $parsed['id_base'] = $matches[1]; $parsed['number'] = (int) $matches[2]; } else { // Likely an old single widget. $parsed['id_base'] = $id; } return $parsed; }