widget_block_content хук-фильтрWP 5.8.0

Filters the content of the Block widget before output.

Использование

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(строка)
The widget content.
$instance(массив)
Array of settings for the current widget.
$widget(WP_Widget_Block)
Current Block widget instance.

Список изменений

С версии 5.8.0 Введена.

Где вызывается хук

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
);

Где используется хук в WordPress

wp-includes/class-wp-embed.php 35
add_filter( 'widget_block_content', array( $this, 'run_shortcode' ), 8 );
wp-includes/class-wp-embed.php 43
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 );