Uses
Uses | Description |
---|---|
wp-includes/class-wp-error.php: WP_Error::__construct() | Initialize the error. |
Converts a widget setting ID (option path) to its id_base and number components.
(string) (Required) Widget setting ID.
(array|WP_Error) Array containing a widget's id_base and number components, or a WP_Error object.
File: wp-includes/class-wp-customize-widgets.php
public function parse_widget_setting_id( $setting_id ) { if ( ! preg_match( '/^(widget_(.+?))(?:\[(\d+)\])?$/', $setting_id, $matches ) ) { return new WP_Error( 'widget_setting_invalid_id' ); } $id_base = $matches[2]; $number = isset( $matches[3] ) ? intval( $matches[3] ) : null; return compact( 'id_base', 'number' ); }
Version | Description |
---|---|
3.9.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_customize_widgets/parse_widget_setting_id