#59338 closed enhancement (fixed)
Themes: Inject theme attribute during block serialization
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.4 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Themes | Keywords: | |
Focuses: | Cc: |
Description
Rather than using _inject_theme_attribute_in_block_template_content
to inject the theme
attribute into all Template Part blocks found in a given file-based Block Template, introduce a new function tentatively called _inject_theme_attribute_in_template_part_block
, and use that as second argument to serialize_blocks()
(introduced in [56557]) in order to inject said attribute during tree traversal for serialization.
This allows for a more modular approach that will eventually be extended to implement automatic insertion of hooked blocks (see #59313).
Change History (4)
#4
@
3 months ago
@gziolo @bernhard-reiter Just to double check whether that is correct, looking at https://github.com/WordPress/wordpress-develop/pull/5192#issuecomment-1719000338, it appears this change (plus the underlying function from #59327) is a quite notable performance improvement?
Curious whether that was an intended goal here, and I wonder if you have more context where the benefit could come from? Potentially the removed call to _flatten_blocks()
is responsible for that? That function at least seems somewhat expensive to me.
In 56578: