Make WordPress Core

Opened 20 months ago

Last modified 20 months ago

#54931 new defect (bug)

get_block_template filter not fired when template saved in posts

Reported by: ianmjones's profile ianmjones Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.9
Component: Editor Keywords: has-patch needs-testing
Focuses: Cc:


The \get_block_template() function fires a 'get_block_template' filter at the end that allows for plugins to filter the content etc.

However, this only works if the template was retrieved from a theme's template file, if the template has been edited it is saved into the posts table.

When a template (part) is found in the posts table the function exits early with the found template but does not wrap the return in a call to the 'get_block_template'.

This means plugins and custom code do not get a chance to filter the template's content or properties when re-editing after a template has had an initial edit.

Attachments (1)

54391.patch (559 bytes) - added by ianmjones 20 months ago.
Simple patch.

Download all attachments as: .zip

Change History (4)

20 months ago

Simple patch.

#1 @ianmjones
20 months ago

  • Keywords has-patch needs-testing added

#2 @ianmjones
20 months ago

  • Summary changed from get_block_template filter not fired when saved in posts to get_block_template filter not fired when template saved in posts

This ticket was mentioned in Slack in #core-test by hellofromtonya. View the logs.

20 months ago

Note: See TracTickets for help on using tickets.