wp_widget_description

Retrieve description for widget.

Description

(string|void) wp_widget_description( (int|string) $id ); 

When registering widgets, the options can also include description that describes the widget for display on the widget administration panel or in the theme.

Returns (string|void)

Widget description, if available.

Parameters (1)

0. $id (int|string)
Widget ID.

Usage

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

Defined (1)

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

/wp-includes/widgets.php  
  1. function wp_widget_description( $id ) { 
  2. if ( !is_scalar($id) ) 
  3. return; 
  4.  
  5. global $wp_registered_widgets; 
  6.  
  7. if ( isset($wp_registered_widgets[$id]['description']) ) 
  8. return esc_html( $wp_registered_widgets[$id]['description'] );