render_block_context WordPress Filter Hook

The render_block_context hook is a hook that allows you to modify the context in which a given block is rendered. This can be useful, for example, if you want to change the way a block is rendered in a specific context (e.g. on a specific post type or in a specific language).

apply_filters( 'render_block_context', array $context, array $parsed_block, WP_Block|null $parent_block ) #

Filters the default context provided to a rendered block.


Parameters

$context

(array)Default context.

$parsed_block

(array)Block being rendered, filtered by render_block_data.

$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.5.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.