widget_text_content
Filters the content of the Text widget to apply changes expected from the visual (TinyMCE) editor.
By default a subset of the_content filters are applied, including wpautop and wptexturize.
Usage
add_filter( 'widget_text_content', 'wp_kama_widget_text_content_filter', 10, 3 ); /** * Function for `widget_text_content` filter-hook. * * @param string $text The widget content. * @param array $instance Array of settings for the current widget. * @param WP_Widget_Text $widget Current Text widget instance. * * @return string */ function wp_kama_widget_text_content_filter( $text, $instance, $widget ){ // filter... return $text; }
- $text(string)
- The widget content.
- $instance(array)
- Array of settings for the current widget.
- $widget(WP_Widget_Text)
- Current Text widget instance.
Changelog
Since 4.8.0 | Introduced. |
Where the hook is called
wp-includes/widgets/class-wp-widget-text.php 298
$text = apply_filters( 'widget_text_content', $text, $instance, $this );
Where the hook is used in WordPress
wp-includes/class-wp-embed.php 34
add_filter( 'widget_text_content', array( $this, 'run_shortcode' ), 8 );
wp-includes/class-wp-embed.php 42
add_filter( 'widget_text_content', array( $this, 'autoembed' ), 8 );
wp-includes/default-filters.php 238
add_filter( 'widget_text_content', 'capital_P_dangit', 11 );
wp-includes/default-filters.php 239
add_filter( 'widget_text_content', 'wptexturize' );
wp-includes/default-filters.php 240
add_filter( 'widget_text_content', 'convert_smilies', 20 );
wp-includes/default-filters.php 241
add_filter( 'widget_text_content', 'wpautop' );
wp-includes/default-filters.php 242
add_filter( 'widget_text_content', 'shortcode_unautop' );
wp-includes/default-filters.php 243
add_filter( 'widget_text_content', 'wp_replace_insecure_home_url' );
wp-includes/default-filters.php 244
add_filter( 'widget_text_content', 'do_shortcode', 11 ); // Runs after wpautop(); note that $post global will be null when shortcodes run.
wp-includes/default-filters.php 245
add_filter( 'widget_text_content', 'wp_filter_content_tags', 12 ); // Runs after do_shortcode().