Filter hook 'widget_block_content'

in WP Core File wp-includes/widgets/class-wp-widget-block.php at line 77

View Source

widget_block_content

Filter Hook
Description
Filters the content of the Block widget before output.

Hook Information

File Location wp-includes/widgets/class-wp-widget-block.php View on GitHub
Hook Type Filter
Line Number 77

Hook Parameters

Type Name Description
string $content The widget content.
array $instance Array of settings for the current widget.
WP_Widget_Block $widget Current Block widget instance.

Usage Examples

Basic Usage
<?php
// Hook into widget_block_content
add_filter('widget_block_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-block.php:77 - How this hook is used in WordPress core
<?php
  72  		 *
  73  		 * @param string          $content  The widget content.
  74  		 * @param array           $instance Array of settings for the current widget.
  75  		 * @param WP_Widget_Block $widget   Current Block widget instance.
  76  		 */
  77  		echo apply_filters(
  78  			'widget_block_content',
  79  			$instance['content'],
  80  			$instance,
  81  			$this
  82  		);

PHP Documentation

<?php
/**
		 * Filters the content of the Block widget before output.
		 *
		 * @since 5.8.0
		 *
		 * @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.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/widgets/class-wp-widget-block.php
Related Hooks

Related hooks will be displayed here in future updates.