WordPress filter hook · part of WordPress core

pre_render_block

A WordPress core filter that 10 plugins also fire themselves, running on 51K+ sites between them.

“This filter is documented in wp-includes/blocks.php”

How to use pre_render_block

It's a filter: your callback receives the value and 2 more arguments, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'pre_render_block', function( $value, $parsed_block, $parent_block ) {
	// Change $value here.
	return $value;
}, 10, 3 );

Argument names come from News Element's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

This hook is fired by WordPress core too. Official reference on developer.wordpress.org →

10 plugins that fire pre_render_block

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Gallery by Visual Portfolio icon Gallery by Visual Portfolio50,000+ installs apply_filters( 'pre_render_block', null, $item, $block ) gutenberg/blocks/loop-filter/index.php:274
  2. GRO icon GRO300+ installs apply_filters( 'pre_render_block', null, $inner->parsed_block, $parent ) includes/Blocks/ContentGateBlock.php:601
  3. News Element icon News Element200+ installs apply_filters( 'pre_render_block', null, $inner_block->parsed_block, $parent_block ) controls/modules/nested-elements/includes/class-nested-block-base.php:182
  4. MindCat icon MindCat100+ installs apply_filters( 'pre_render_block', null, $inner_block->parsed_block, $block_class ) inc/class-mindcat.php:290
  5. Etchenet Scroll Video Background Builder icon Etchenet Scroll Video Background Builder20+ installs apply_filters( 'pre_render_block', null, $inner_block->parsed_block, $block ) includes/class-block.php:225
  6. PDF Invoice Builder for WooCommerce icon PDF Invoice Builder for WooCommerceFewer than 10 installs apply_filters( 'pre_render_block', null, $inner_block->parsed_block, $parent_block ) lib/block-controls/modules/nested-elements/includes/class-nested-block-base.php:182
  7. Fieldwren icon FieldwrenFewer than 10 installs apply_filters( 'pre_render_block', null, $inner_block->parsed_block, $parent_block ) lib/block-controls/modules/nested-elements/includes/class-nested-block-base.php:182
  8. Email Customizer icon Email CustomizerFewer than 10 installs apply_filters( 'pre_render_block', null, $inner_block->parsed_block, $parent_block ) lib/block-controls/modules/nested-elements/includes/class-nested-block-base.php:182
  9. Gutenberg Login Page Customizer icon Gutenberg Login Page CustomizerFewer than 10 installs apply_filters( 'pre_render_block', null, $inner_block->parsed_block, $parent_block ) block-controls/nested/class-nested-block-base.php:182
  10. Flexify Blocks & Addons for Gutenberg icon Flexify Blocks & Addons for GutenbergFewer than 10 installs apply_filters( 'pre_render_block', null, $inner->parsed_block, $block ) build/blocks/query-loop/render.php:53

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.