widget_text хук-фильтр . WP 2.3.0
Filters the content of the Text widget.
Использование
add_filter( 'widget_text', 'filter_function_name_3438', 10, 3 ); function filter_function_name_3438( $text, $instance, $this ){ // filter... return $text; }
- $text(строка)
- The widget content.
- $instance(массив)
- Array of settings for the current widget.
- $this(WP_Widget_Text/WP_Widget_Custom_HTML)
- Current Text widget instance.
Список изменений
С версии 2.3.0 | Введена. |
С версии 4.4.0 | Added the $this parameter. |
С версии 4.8.1 | The $this param may now be a WP_Widget_Custom_HTML object in addition to a WP_Widget_Text object. |
Где вызывается хук
wp-includes/widgets/class-wp-widget-text.php 280
$text = apply_filters( 'widget_text', $text, $instance, $this );
wp-includes/widgets/class-wp-widget-custom-html.php 147
$content = apply_filters( 'widget_text', $instance['content'], $simulated_text_widget_instance, $this );
Где используется хук в ядре WordPress
wp-includes/widgets/class-wp-widget-text.php 205
add_filter( 'widget_text', 'balanceTags' );
wp-includes/widgets/class-wp-widget-text.php 253
remove_filter( 'widget_text', 'do_shortcode', $widget_text_do_shortcode_priority );
wp-includes/widgets/class-wp-widget-text.php 324
add_filter( 'widget_text', 'do_shortcode', $widget_text_do_shortcode_priority );