diff --git a/packages/block-library/src/pattern/edit.js b/packages/block-library/src/pattern/edit.js index e8068faf5013d9..b52c50ec564c54 100644 --- a/packages/block-library/src/pattern/edit.js +++ b/packages/block-library/src/pattern/edit.js @@ -37,13 +37,7 @@ const PatternEdit = ( { attributes, clientId } ) => { ) ) { block.innerBlocks = block.innerBlocks.map( ( innerBlock ) => { - if ( - innerBlock.name === 'core/template-part' && - innerBlock.attributes.theme === undefined - ) { - innerBlock.attributes.theme = currentThemeStylesheet; - } - return innerBlock; + return injectThemeAttributeInBlockTemplateContent( innerBlock ); } ); } diff --git a/packages/edit-site/src/components/start-template-options/index.js b/packages/edit-site/src/components/start-template-options/index.js index fe4179a338504b..4fc113bc46912f 100644 --- a/packages/edit-site/src/components/start-template-options/index.js +++ b/packages/edit-site/src/components/start-template-options/index.js @@ -63,13 +63,7 @@ function useStartPatterns( fallbackContent ) { ) ) { block.innerBlocks = block.innerBlocks.map( ( innerBlock ) => { - if ( - innerBlock.name === 'core/template-part' && - innerBlock.attributes.theme === undefined - ) { - innerBlock.attributes.theme = currentThemeStylesheet; - } - return innerBlock; + return injectThemeAttributeInBlockTemplateContent( innerBlock ); } ); }