Title: widget_block_content
Published: July 20, 2021
Last modified: February 24, 2026

---

# apply_filters( ‘widget_block_content’, string $content, array $instance, WP_Widget_Block $widget )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/widget_block_content/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/widget_block_content/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/widget_block_content/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/widget_block_content/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/widget_block_content/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/widget_block_content/?output_format=md#wp--skip-link--target)

Filters the content of the Block widget before output.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/widget_block_content/?output_format=md#parameters)󠁿

 `$content`string

The widget content.

`$instance`array

Array of settings for the current widget.

`$widget`[WP_Widget_Block](https://developer.wordpress.org/reference/classes/wp_widget_block/)

Current Block widget instance.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/widget_block_content/?output_format=md#source)󠁿

    ```php
    echo apply_filters(
    	'widget_block_content',
    	$instance['content'],
    	$instance,
    	$this
    );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets/class-wp-widget-block.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/widgets/class-wp-widget-block.php#L77)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/widgets/class-wp-widget-block.php#L77-L82)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/widget_block_content/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_Widget_Block::widget()](https://developer.wordpress.org/reference/classes/wp_widget_block/widget/)`wp-includes/widgets/class-wp-widget-block.php` |

Outputs the content for the current Block widget instance.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/widget_block_content/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/widget_block_content/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/widget_block_content/?output_format=md#comment-content-6356)
 2.   [Alvaro Torres](https://profiles.wordpress.org/algato333/)  [  3 years ago  ](https://developer.wordpress.org/reference/hooks/widget_block_content/#comment-6356)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwidget_block_content%2F%23comment-6356)
    Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwidget_block_content%2F%23comment-6356)
 4. Really useful if, for example, we want to translate a piece of text (or change 
    HTML code).
     Example:
 5.     ```php
        function wpdocs_translating_widget( $content ) {
            $locale = get_locale();
            if ( is_home() && $locale !== 'es_ES' ) {
                $replace = array(
                    'Entradas recientes' => 'Recent entries',
                    'BUSCAR' => 'SEARCH',
                );
                $content = str_replace( array_keys( $replace ), $replace, $content );
            }
            return $content;
        }  
        add_filter( 'widget_block_content', 'wpdocs_translating_widget' );
        ```
    
 6.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwidget_block_content%2F%3Freplytocom%3D6356%23feedback-editor-6356)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwidget_block_content%2F)
before being able to contribute a note or feedback.