[wp-trac] [WordPress Trac] #55996: the get_the_block_template_html call all the same functions as the the_conent filter so they are run twice

WordPress Trac noreply at wordpress.org
Fri Jun 17 09:59:55 UTC 2022


#55996: the get_the_block_template_html call all the same functions as the
the_conent filter so they are run twice
------------------------------------------+------------------------------
 Reporter:  pbearne                       |       Owner:  (none)
     Type:  defect (bug)                  |      Status:  new
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  Formatting                    |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:  performance
------------------------------------------+------------------------------

Comment (by SergeyBiryukov):

 Hi there, thanks for the ticket!

 As far as I can tell, `get_the_block_template_html()` is only used in
 [source:tags/6.0/src/wp-includes/template-canvas.php?marks=12#L1 wp-
 includes/template-canvas.php] and is not run through `the_content`, so it
 looks like these functions are not run twice. Still, these direct calls
 seem inconsistent.

 I think we should be able to just apply `the_content` filter here, like we
 do in other similar places in core:
 {{{
 $content = apply_filters( 'the_content', $content );
 }}}
 Has there been any discussion in Gutenberg on why that approach was not
 chosen here, and the functions are called directly instead? Is it be cause
 `the_content` may also include other callbacks that would not be expected
 here?

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


More information about the wp-trac mailing list