Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: widget_custom_html_content

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
152           /**
153            * Filters the content of the Custom HTML widget.
154            *
155            * @since 4.8.1
156            *
157            * @param string                $content  The widget content.
158            * @param array                 $instance Array of settings for the current widget.
159            * @param WP_Widget_Custom_HTML $widget   Current Custom HTML widget instance.
160            */
161           $content = apply_filters( 'widget_custom_html_content', $content, $instance, $this );
162
163           // Restore post global.
164           $post = $original_post;
165           remove_filter( 'shortcode_atts_gallery', array( $this, '_filter_gallery_shortcode_attrs' ) );
166
167           // Inject the Text widget's container class name alongside this widget's class name for theme styling compatibility.
168           $args['before_widget'] = preg_replace( '/(?<=\sclass=["\'])/', 'widget_text ', $args['before_widget'] );
169
170           echo $args['before_widget'];