Make WordPress Core

Opened 5 weeks ago

Last modified 4 weeks ago

#61446 assigned enhancement

Move content processing in get_the_block_template_html() to filters.

Reported by: joemcgill's profile joemcgill Owned by: joemcgill's profile joemcgill
Milestone: 6.7 Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch
Focuses: Cc:


When get_the_block_template_html() was added in [51003] it hard coded all of the content processing that is applied in classic themes to post content via default filters like the_content, the_excerpt, etc. This includes, but is not limited, to the following processing functions:

  • wp_embed->run_shortcode
  • wp_embed->autoembed
  • shortcode_unautop
  • do_shortcode
  • do_blocks
  • wptexturize
  • convert_smilies
  • wp_filter_content_tags

This has resulted in bugs like #55996 and also makes it impossible to run post processing on the full contents of a block template before it is rendered to the template canvas (example use case).

To address this we can introduce a new filter, the_block_template_html, and move all of the processing to that filter instead. See this PR for an initial proof of concept. Sidenote: this was originally proposed as a way to address #55996 but is really an enhancement with broader implications, so a separate ticket seems warranted.

Change History (1)

This ticket was mentioned in Slack in #core-performance by joemcgill. View the logs.

4 weeks ago

Note: See TracTickets for help on using tickets.