[wp-trac] [WordPress Trac] #59131: Introduce filters to modify/inspect the blocks returned by `do_blocks()`

WordPress Trac noreply at wordpress.org
Fri Aug 18 22:33:36 UTC 2023


#59131: Introduce filters to modify/inspect the blocks returned by `do_blocks()`
--------------------------------------------------+-----------------------
 Reporter:  luisherranz                           |       Owner:  gziolo
     Type:  enhancement                           |      Status:  assigned
 Priority:  normal                                |   Milestone:  6.4
Component:  Editor                                |     Version:  trunk
 Severity:  normal                                |  Resolution:
 Keywords:  has-patch has-unit-tests 2nd-opinion  |     Focuses:
--------------------------------------------------+-----------------------
Changes (by azaozz):

 * keywords:  has-patch has-unit-tests => has-patch has-unit-tests 2nd-
               opinion


Comment:

 Sorry but to me it seems that both of these filters re mostly useless.
 Could you please provide some practical examples where and how they can be
 used?

 In addition, looking at the proposed `do_blocks_pre_render`: it filters
 the output from `WP_Block_Parser::parse()`. However
 `WP_Block_Parser::parse()` is used in several places in core, for example
 in templates. If such filtering makes sense wouldn't it be better to
 filter the output from the parser in the actual parser? I.e. Add a filter
 on the return value in `WP_Block_Parser::parse()`.

 Looking at the proposed `do_blocks_post_render` in `do_blocks( $content
 )`. How is that different than `the_content` filter?

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


More information about the wp-trac mailing list