pre_render_block WordPress Filter Hook

The pre_render_block hook is called before a block is rendered. It allows you to modify the block before it is rendered. This can be useful for adding dynamic content to a block, or for modifying the output of a block.

apply_filters( 'pre_render_block', string|null $pre_render, array $parsed_block, WP_Block|null $parent_block ) #

Allows render_block() to be short-circuited, by returning a non-null value.


Parameters

$pre_render

(string|null)The pre-rendered content. Default null.

$parsed_block

(array)The block being rendered.

$parent_block

(WP_Block|null)If this is a nested block, a reference to the parent block.


Top ↑

Source

File: wp-includes/blocks.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.9.0The $parent_block parameter was added.
5.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.