Make WordPress Core

Opened 4 months ago

#60063 new enhancement

Add a dynamic hook to filter the pre-rendered content of a single block.

Reported by: gigitux's profile gigitux Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Editor Keywords:
Focuses: Cc:


Introducing a dynamic hook, pre_render_block_{$block_name}, as a complement to the already valuable pre_render_block hook could increase the developer experience. This new hook aims to filter the pre-rendered content for a specific block, eliminating the need for conditional statements within the pre_render_block filter callback. I searched on GitHub, and many folks use the pre_render_block and add a check to ensure the logic runs only for a specific block.

Some examples:

For the same reason, the render_block_{$block_name} hook has been implemented:

I'm happy to work on it!

Change History (0)

Note: See TracTickets for help on using tickets.