W3cubDocs

/WordPress

apply_filters( ‘widget_text’, string $text, array $instance, WP_Widget_Text|WP_Widget_Custom_HTML $widget )

Filters the content of the Text widget.

Parameters

$textstring
The widget content.
$instancearray
Array of settings for the current widget.
$widgetWP_Widget_Text|WP_Widget_Custom_HTML
Current text or HTML widget instance.

More Information

May also apply to some third party widgets as well. This filter hook can be used to replace any text within sidebar widgets.

Source

$text = apply_filters( 'widget_text', $text, $instance, $this );

Changelog

Version Description
4.8.1 The $widget param may now be a WP_Widget_Custom_HTML object in addition to a WP_Widget_Text object.
4.4.0 Added the $widget parameter.
2.3.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/widget_text