[wp-trac] [WordPress Trac] #49442: Request: filter for parse_blocks() result
WordPress Trac
noreply at wordpress.org
Sat Feb 15 04:43:18 UTC 2020
#49442: Request: filter for parse_blocks() result
-----------------------------+-----------------------------
Reporter: dougwollison | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: |
-----------------------------+-----------------------------
I'd like to be able to access and if needed modify the parsed blocks for a
page before it's rendered on the frontend. My particular use case invovles
ensuring pages have a certain structure with some exceptions that can't
reliably be address by simply using hasBlockType or filtering an
individual block's data.
My current solution is to hook into the `block_parser_class` filter and
return my own extension that simply filters the ouptut of
`WP_Block_Parser:parse()`. It works great but it's a bit of a round-about
way.
I think for sanity/caching friendliness it should be added in the return
logic of `parse_blocks()`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49442>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list