WP_Widget_Block::widget()publicWP 5.8.0

Outputs the content for the current Block widget instance.

Method of the class: WP_Widget_Block{}

Hooks from the method


null. Nothing (null).


$WP_Widget_Block = new WP_Widget_Block();
$WP_Widget_Block->widget( $args, $instance );
$args(array) (required)
Display arguments including 'before_title', 'after_title', 'before_widget', and 'after_widget'.
$instance(array) (required)
Settings for the current Block widget instance.


Since 5.8.0 Introduced.

WP_Widget_Block::widget() code WP 6.5.2

public function widget( $args, $instance ) {
	$instance = wp_parse_args( $instance, $this->default_instance );

	echo str_replace(
		$this->get_dynamic_classname( $instance['content'] ),

	 * 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.
	echo apply_filters(

	echo $args['after_widget'];