apply_filters( 'widget_text', string $text, array $instance, WP_Widget_Text|WP_Widget_Custom_HTML $widget )
- Since
- 2.3.0, 4.4.0, 4.8.1
Filters the content of the Text widget.
Compatibility
- WordPress
- since 4.8.1
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
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.
Where this hook fires · 2
wp-includes/widgets/class-wp-widget-custom-html.php:150WP_Widget_Custom_HTML::widget()wp-includes/widgets/class-wp-widget-text.php:283WP_Widget_Text::widget()
Source code
* @since 4.8.1 The `$widget` param may now be a `WP_Widget_Custom_HTML` object in addition to a `WP_Widget_Text` object. * * @param string $text The widget content. * @param array $instance Array of settings for the current widget. * @param WP_Widget_Text|WP_Widget_Custom_HTML $widget Current text or HTML widget instance. */ $text = apply_filters( 'widget_text', $text, $instance, $this ); if ( $is_visual_text_widget ) { /** * Filters the content of the Text widget to apply changes expected from the visual (TinyMCE) editor. *Changelog
Introduced in 2.3.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
4.8.1
The
$widget param may now be a WP_Widget_Custom_HTML object in addition to a WP_Widget_Text object.from the docblock4.4.0
Added the
$widget parameter.from the docblock2.3.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.