wp_widget_description()
Retrieves description for widget.
When registering widgets, the options can also include 'description' that describes the widget for display on the widget administration panel or in the theme.
No Hooks.
Returns
String|null. Widget description, if available.
Usage
wp_widget_description( $id );
- $id(int|string) (required)
- Widget ID.
Notes
- Global. Array.
$wp_registered_widgetsThe registered widgets.
Changelog
| Since 2.5.0 | Introduced. |
wp_widget_description() wp widget description code WP 6.9.1
function wp_widget_description( $id ) {
if ( ! is_scalar( $id ) ) {
return;
}
global $wp_registered_widgets;
if ( isset( $wp_registered_widgets[ $id ]['description'] ) ) {
return esc_html( $wp_registered_widgets[ $id ]['description'] );
}
}