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
146           /**
147            * Filters the content of the Custom HTML widget.
148            *
149            * @since 4.8.1
150            *
151            * @param string                $content  The widget content.
152            * @param array                 $instance Array of settings for the current widget.
153            * @param WP_Widget_Custom_HTML $this     Current Custom HTML widget instance.
154            */
155           $content = apply_filters( 'widget_custom_html_content', $content, $instance, $this );
156
157           // Restore post global.
158           $post = $original_post;
159           remove_filter( 'shortcode_atts_gallery', array( $this, '_filter_gallery_shortcode_attrs' ) );
160
161           // Inject the Text widget's container class name alongside this widget's class name for theme styling compatibility.
162           $args['before_widget'] = preg_replace( '/(?<=\sclass=["\'])/', 'widget_text ', $args['before_widget'] );
163
164           echo $args['before_widget'];