Filter hook 'render_block'

in WP Core File wp-includes/class-wp-block.php at line 638

View Source

render_block

Filter Hook
Description
Filters the content of a single block.

Hook Information

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

Hook Parameters

Type Name Description
string $block_content The block content.
array $block The full block, including name and attributes.
WP_Block $instance The block instance.

Usage Examples

Basic Usage
<?php
// Hook into render_block
add_filter('render_block', 'my_custom_filter', 10, 3);

function my_custom_filter($block_content, $block, $instance) {
    // Your custom filtering logic here
    return $block_content;
}

Source Code Context

wp-includes/class-wp-block.php:638 - How this hook is used in WordPress core
<?php
 633  		 *
 634  		 * @param string   $block_content The block content.
 635  		 * @param array    $block         The full block, including name and attributes.
 636  		 * @param WP_Block $instance      The block instance.
 637  		 */
 638  		$block_content = apply_filters( 'render_block', $block_content, $this->parsed_block, $this );
 639  
 640  		/**
 641  		 * Filters the content of a single block.
 642  		 *
 643  		 * The dynamic portion of the hook name, `$name`, refers to

PHP Documentation

<?php
/**
		 * Filters the content of a single block.
		 *
		 * @since 5.0.0
		 * @since 5.9.0 The `$instance` parameter was added.
		 *
		 * @param string   $block_content The block content.
		 * @param array    $block         The full block, including name and attributes.
		 * @param WP_Block $instance      The block instance.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/class-wp-block.php
Related Hooks

Related hooks will be displayed here in future updates.