[wp-trac] [WordPress Trac] #49442: Request: filter for parse_blocks() result
WordPress Trac
noreply at wordpress.org
Thu Jun 12 17:42:45 UTC 2025
#49442: Request: filter for parse_blocks() result
---------------------------------------+---------------------
Reporter: dougwollison | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone: 6.9
Component: General | Version: 5.0
Severity: normal | Resolution:
Keywords: has-patch needs-test-info | Focuses:
---------------------------------------+---------------------
Comment (by justlevine):
With some helpful pointers from @SirLouen , I added the following PHPUnit
tests. It's possible they'd exist better as a manual "test use case" and
my desire to get this into core pushed me overboard 😇.
=== Test use cases ===
1. Changing individual properties - the most straightforward use of
`add_filter( 'parse_blocks', ...)` that will allow us to decouple
rendering from parsing
2. An example caching implementation:
1. `parse_blocks` filter adds a cache ID to the block atts
2. `render_block` filter stores the rendered block in `wp_cache_*()`
3. `pre_render_block` returns the cached block early, so it doesn't
need to be re-rendered.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49442#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list