widget_block_content filter-hookWP 5.8.0

Filters the content of the Block widget before output.

Usage

add_filter( 'widget_block_content', 'wp_kama_widget_block_content_filter', 10, 3 );

/**
 * Function for `widget_block_content` filter-hook.
 * 
 * @param string          $content  The widget content.
 * @param array           $instance Array of settings for the current widget.
 * @param WP_Widget_Block $widget   Current Block widget instance.
 *
 * @return string
 */
function wp_kama_widget_block_content_filter( $content, $instance, $widget ){

	// filter...
	return $content;
}
$content(string)
The widget content.
$instance(array)
Array of settings for the current widget.
$widget(WP_Widget_Block)
Current Block widget instance.

Changelog

Since 5.8.0 Introduced.

Where the hook is called

WP_Widget_Block::widget()
widget_block_content
wp-includes/widgets/class-wp-widget-block.php 77-82
echo apply_filters(
	'widget_block_content',
	$instance['content'],
	$instance,
	$this
);

Where the hook is used in WordPress

wp-includes/class-wp-embed.php 34
add_filter( 'widget_block_content', array( $this, 'run_shortcode' ), 8 );
wp-includes/class-wp-embed.php 42
add_filter( 'widget_block_content', array( $this, 'autoembed' ), 8 );
wp-includes/default-filters.php 229
add_filter( 'widget_block_content', 'do_blocks', 9 );
wp-includes/default-filters.php 230
add_filter( 'widget_block_content', 'wp_filter_content_tags' );
wp-includes/default-filters.php 231
add_filter( 'widget_block_content', 'do_shortcode', 11 );