You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Save unedited theme patterns in templates as pattern references #894
When a theme pattern is inserted into a template in the Site Editor, the editor adds a full copy of its blocks and marks the root block with metadata.patternName. Saving the template with Create Block Theme writes that copy into the theme file. The theme ends up with the same section twice: once in its own pattern file and once inside the template's pattern.
The two copies drift apart over time. A fix made later to the section pattern never reaches the copy in the template.
Core themes avoid this by building templates from references:
On save, CBT could check each block that has a metadata.patternName pointing to a pattern registered by the active theme. If its content still matches that pattern, CBT would write a wp:pattern reference in its place. Blocks that were edited after insertion would stay inline as they are now.
Related: #872, which covers the patternName metadata that saving leaves behind.
Drafted with AI assistance, reproduced and verified by me.
Activity