[wp-trac] [WordPress Trac] #59969: Conditional loading `build_template_part_block_variations` for performance improvement

WordPress Trac noreply at wordpress.org
Mon Jan 22 09:36:45 UTC 2024


#59969: Conditional loading `build_template_part_block_variations` for performance
improvement
--------------------------------------+--------------------------
 Reporter:  thekt12                   |       Owner:  joemcgill
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  6.5
Component:  General                   |     Version:
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch needs-dev-note  |     Focuses:  performance
--------------------------------------+--------------------------

Comment (by gaambo):

 Replying to [comment:48 spacedmonkey]:
 > Thanks for the heads up @gaambo.
 >
 > Can I recommend using the `register_block_type_args` filter if possible,
 instead of how you have added those variations in.
 >
 > On the core merge, there I recommend using the
 `get_block_type_variations` filter.

 No, unfortunately using `register_block_type_args` is not possible. The
 whole point of the PRs was to add variations for custom post types and
 taxonomies that are registered _AFTER_ the block is registered. And since
 there is no server-side API for registering block variations I had to
 directly set the `variations` attribute.

 I will have a look at the `get_block_type_variations` filter, that could
 work. But would be a rewrite of the existing (already merged into GB) PRs.
 So should I open a new Gutenberg issue for this change, should this happen
 in the core merge? I'm kind of confused how to handle this 😅

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59969#comment:49>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list