wp_widget_description()WP 2.5.0

Retrieve 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.

Хуков нет.

Возвращает

Строку|null. Widget description, if available.

Использование

wp_widget_description( $id );
$id(int|строка) (обязательный)
Widget ID.

Заметки

  • Global. Массив. $wp_registered_widgets

Список изменений

С версии 2.5.0 Введена.

Код wp_widget_description() WP 6.4.3

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'] );
	}
}