[wp-trac] [WordPress Trac] #54684: Add ability to filter blocks in WP_Block_List

WordPress Trac noreply at wordpress.org
Mon Jan 3 18:05:24 UTC 2022


#54684: Add ability to filter blocks in WP_Block_List
-------------------------+-----------------------------
 Reporter:  afragen      |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  5.9
Component:  Menus        |     Version:  5.5
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  administration
-------------------------+-----------------------------

Comment (by hellofromTonya):

 I don't think introducing a filter in the constructor of `WP_Block_List`
 is the right approach to gain access to the nav blocks. Why?

 * This class has existed since 5.0.
 * It is not exclusively for nav blocks, but rather all blocks use it.
 * Adding a filter to this constructor will increase processing time and
 memory, meaning the introduction of this filter will cause a performance
 hit.

 If the goal is to gain access to a ''specific type of block'', then
 filtering could be done within the specific block's published library
 files. But looking at other blocks, I don't see a similar filter. There
 are filters available in `WP_Block` to gain access to ''each'' block.

 Kind of thinking this ticket needs to move upstream to Gutenberg. If it is
 a regression, regressions can be considered during RC. But likely the
 addition of a filter would be introduced upstream first and then
 backported.

 @afragen Can you open an issue upstream please?

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


More information about the wp-trac mailing list