Filter hook 'widget_custom_html_content'

in WP Core File wp-includes/widgets/class-wp-widget-custom-html.php at line 161

View Source

widget_custom_html_content

Filter Hook
Description
Filters the content of the Custom HTML widget.

Hook Information

File Location wp-includes/widgets/class-wp-widget-custom-html.php View on GitHub
Hook Type Filter
Line Number 161

Hook Parameters

Type Name Description
string $content The widget content.
array $instance Array of settings for the current widget.
WP_Widget_Custom_HTML $widget Current Custom HTML widget instance.

Usage Examples

Basic Usage
<?php
// Hook into widget_custom_html_content
add_filter('widget_custom_html_content', 'my_custom_filter', 10, 3);

function my_custom_filter($content, $instance, $widget) {
    // Your custom filtering logic here
    return $content;
}

Source Code Context

wp-includes/widgets/class-wp-widget-custom-html.php:161 - How this hook is used in WordPress core
<?php
 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  

PHP Documentation

<?php
/**
		 * Filters the content of the Custom HTML widget.
		 *
		 * @since 4.8.1
		 *
		 * @param string                $content  The widget content.
		 * @param array                 $instance Array of settings for the current widget.
		 * @param WP_Widget_Custom_HTML $widget   Current Custom HTML widget instance.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/widgets/class-wp-widget-custom-html.php
Related Hooks

Related hooks will be displayed here in future updates.