Filters the content of a single block.
Description
The dynamic portion of the hook name, $name
, refers to the block name, e.g. "core/paragraph".
Parameters
$block_content
string- The block content.
$block
array- The full block, including name and attributes.
$instance
WP_Block- The block instance.
Source
$block_content = apply_filters( "render_block_{$this->name}", $block_content, $this->parsed_block, $this );
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: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.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:
See this issue for more details.
$block
is array with keys:These keys are explained and referenced in WP_Block
Filter the core navigation block conditionally. Prepends content to the core navigation block.