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