Title: render_block_{$this-&gt;name}
Published: March 9, 2021
Last modified: May 20, 2026

---

# apply_filters( “render_block_{$this->name}”, string $block_content, array $block, WP_Block $instance )

## In this article

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

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

Filters the content of a single block.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/render_block_this-name/?output_format=md#description)󠁿

The dynamic portion of the hook name, `$name`, refers to the block name, e.g. “core/
paragraph”.

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

 `$block_content`string

The block content.

`$block`array

The full block, including name and attributes.

`$instance`[WP_Block](https://developer.wordpress.org/reference/classes/wp_block/)

The block instance.

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

    ```php
    $block_content = apply_filters( "render_block_{$this->name}", $block_content, $this->parsed_block, $this );
    ```

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

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

| Used by | Description | 
| [WP_Block::render()](https://developer.wordpress.org/reference/classes/wp_block/render/)`wp-includes/class-wp-block.php` |

Generates the render output for the block.

  |

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

| Version | Description | 
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | The `$instance` parameter was added. | 
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |

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

 1.   [Skip to note 4 content](https://developer.wordpress.org/reference/hooks/render_block_this-name/?output_format=md#comment-content-6759)
 2.    [Artemio Morales](https://profiles.wordpress.org/artemiosans/)  [  3 years ago  ](https://developer.wordpress.org/reference/hooks/render_block_this-name/#comment-6759)
 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%2Frender_block_this-name%2F%23comment-6759)
     Vote results for this note: 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%2Frender_block_this-name%2F%23comment-6759)
 4.  If you’ve arrived here wondering why your image block with `Expand on Click` enabled
     contains lightbox markup that you seemingly can’t access from inside your filter
     function, here’s some extra information you might need:
 5.  As of WordPress 6.4, please be aware that a built-in filter for the image block
     has been applied with priority 15 for images with `Expand on Click`. This means
     that if your filter has a priority of 15 or lower (the default is 10), then the
     markup used to create the lightbox behavior will NOT be available to your function
     for processing by default.
 6.  Please make sure to use priority of at least 16 when adding filters to process
     the image block if you need to access the lightbox markup:
 7.      ```php
         add_filter( 'render_block_core/image', 'wpdocs_custom_html', 16 )
         ```
     
 8.  See this issue for more details.
 9.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Frender_block_this-name%2F%3Freplytocom%3D6759%23feedback-editor-6759)
 10.  [Skip to note 5 content](https://developer.wordpress.org/reference/hooks/render_block_this-name/?output_format=md#comment-content-5212)
 11.   [Lovro Hrust](https://profiles.wordpress.org/lovor/)  [  5 years ago  ](https://developer.wordpress.org/reference/hooks/render_block_this-name/#comment-5212)
 12. [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%2Frender_block_this-name%2F%23comment-5212)
     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%2Frender_block_this-name%2F%23comment-5212)
 13. `$block` is array with keys:
 14.  * blockName
      * attrs – array of block attributes
      * innerBlocks – array of inner blocks
      * innerHTML – resultant HTML from inside block comment delimiters after removing
        inner blocks.
      * innerContent – list of string fragments and null markers where inner blocks
        were found
 15. These keys are explained and referenced in [WP_Block](https://developer.wordpress.org/reference/classes/wp_block/)
 16.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Frender_block_this-name%2F%3Freplytocom%3D5212%23feedback-editor-5212)
 17.  [Skip to note 6 content](https://developer.wordpress.org/reference/hooks/render_block_this-name/?output_format=md#comment-content-7099)
 18.   [WP SITES](https://profiles.wordpress.org/wordpresssites/)  [  2 years ago  ](https://developer.wordpress.org/reference/hooks/render_block_this-name/#comment-7099)
 19. [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%2Frender_block_this-name%2F%23comment-7099)
     Vote results for this note: 0[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%2Frender_block_this-name%2F%23comment-7099)
 20. Filter the core navigation block conditionally. Prepends content to the core navigation
     block.
 21.     ```php
         add_filter( 'render_block_core/navigation', 'wpdocs_modify_nav_menu_for_admins', 10, 2 );
         function wpdocs_modify_nav_menu_for_admins( $block_content, $block ) {
     
             if ( isset( $block['blockName'] ) && 'core/navigation' === $block['blockName'] ) {
     
                 if ( is_user_logged_in() && current_user_can( 'administrator' ) ) {
     
                     $custom_message = 'Welcome, Admin!';
     
                     $block_content = $custom_message . $block_content;
                 }
             }
     
             return $block_content;
         }
         ```
     
 22.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Frender_block_this-name%2F%3Freplytocom%3D7099%23feedback-editor-7099)

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