_get_widget_id_base

Retrieves the widget ID base value.

Description

(string) _get_widget_id_base( (string) $id ); 

Returns (string)

Widget ID base.

Parameters (1)

0. $id (string)
Widget ID.

Usage

  1. if ( !function_exists( '_get_widget_id_base' ) ) { 
  2. require_once ABSPATH . WPINC . '/widgets.php'; 
  3.  
  4. // Widget ID. 
  5. $id = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = _get_widget_id_base($id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/widgets.php  
  1. function _get_widget_id_base( $id ) { 
  2. return preg_replace( '/-[0-9]+$/', '', $id );