_get_widget_id_base() WordPress Function

The get_widget_id_base() function is used to retrieve the base ID for a given widget. This function is typically used in the context of creating a new widget instance.

_get_widget_id_base( string $id ) #

Retrieves the widget ID base value.


Parameters

$id

(string)(Required)Widget ID.


Top ↑

Return

(string) Widget ID base.


Top ↑

Source

File: wp-includes/widgets.php

function _get_widget_id_base( $id ) {
	return preg_replace( '/-[0-9]+$/', '', $id );
}


Top ↑

Changelog

Changelog
VersionDescription
2.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.