Description
If a theme bundles a pattern in the theme.json file via the repository (https://wordpress.org/patterns/) and then includes that pattern in a header pattern (bundled in the /patterns/ directory), the pattern from the repo is NOT added to the front end of the site when the template part is Replaced from within the Site Editor. It IS, however, seen in the editor (just not the front end).
Tested both with and without the Gutenberg plugin installed.
Expected Behaviour
I would expect that when we replace a header template part with a header pattern, then for the new template part to include all content on the front end, even if that header pattern includes one or more patterns from the WordPress repository https://wordpress.org/patterns/ (added to the theme via theme.json).
Actual Behaviour
When we replace a header template part with a header pattern that includes a pattern from the WordPress repository, the content is added to the editor, but the content generated by the pattern from the WordPress repository is missing from the front end of the website (but visible in the editor).
Step-by-step reproduction instructions
Steps to reproduce, using Twenty Twenty-Three as an example:
- Edit the theme.json file to include a pattern from the repository. For example,
contact-and-social-links.
- Create a
header.php file within the /patterns/ directory. Create a new header pattern (make sure to add Block Types: core/template-part/header). You can just copy the content from the header.html template part.
- Somewhere within the
header.php pattern, include the pattern from the repository. <!-- wp:pattern {"slug":"contact-and-social-links"} /--> as an example.
- In the WordPress admin, click Appearance -> Editor. Click in the Site Editor preview window, to begin editing the index template.
- In the editor, click on the header template part, and click the more options link in the toolbar (three dots). Click Replace Header.
- Select the new header pattern - You should see a preview, which includes the pattern from the repo.
- The header is successfully replaced by the new template part, which is inserted into the editor, which DOES include the pattern we included from the repo.
- Save changes.
- Now if you visit the home page, you will see that the pattern from the repository is missing within the new header. If you go back into the editor, you can see the pattern is there, it is just not being added to the front end for some reason.
- The only way to get the pattern to show up on the front end, is to go into the template part that was automatically created when replacing the old header, make a change, and then save the template part.
Screenshots, screen recording, code snippet
Adding the pattern from the repo to Twenty Twenty-Three, and creating the new header pattern:

In the above gif, you can see me bundle https://wordpress.org/patterns/pattern/contact-and-social-links/ with Twenty Twenty-Three. I then create a new header pattern and include the pattern I bundled from the repo
header.php from the above .gif https://pastebin.com/fuekwb0g.
theme.json from the above .gif https://pastebin.com/Y2QSwW7N.
After theme modifications, steps to reproduce:

After the header template part has been replaced with the new header pattern, we can see that the new header DOES include the content from https://wordpress.org/patterns/pattern/contact-and-social-links/. However, when we visit the front end of the website, this specific content is missing. I then go and modify the template part that was automatically created and save changes, which seems to be the only way to make the additional content added by the pattern from the repo appear on the front end.
Environment info
- WordPress 6.3-alpha.
- Gutenberg 15.7.1.
- Theme: Twenty Twenty-Three, modified to include a custom header pattern and a pattern from the repo.
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Description
If a theme bundles a pattern in the
theme.jsonfile via the repository (https://wordpress.org/patterns/) and then includes that pattern in a header pattern (bundled in the /patterns/ directory), the pattern from the repo is NOT added to the front end of the site when the template part is Replaced from within the Site Editor. It IS, however, seen in the editor (just not the front end).Tested both with and without the Gutenberg plugin installed.
Expected Behaviour
I would expect that when we replace a header template part with a header pattern, then for the new template part to include all content on the front end, even if that header pattern includes one or more patterns from the WordPress repository https://wordpress.org/patterns/ (added to the theme via theme.json).
Actual Behaviour
When we replace a header template part with a header pattern that includes a pattern from the WordPress repository, the content is added to the editor, but the content generated by the pattern from the WordPress repository is missing from the front end of the website (but visible in the editor).
Step-by-step reproduction instructions
Steps to reproduce, using Twenty Twenty-Three as an example:
contact-and-social-links.header.phpfile within the/patterns/directory. Create a new header pattern (make sure to addBlock Types: core/template-part/header). You can just copy the content from theheader.htmltemplate part.header.phppattern, include the pattern from the repository.<!-- wp:pattern {"slug":"contact-and-social-links"} /-->as an example.Screenshots, screen recording, code snippet
Adding the pattern from the repo to Twenty Twenty-Three, and creating the new header pattern:

In the above gif, you can see me bundle https://wordpress.org/patterns/pattern/contact-and-social-links/ with Twenty Twenty-Three. I then create a new header pattern and include the pattern I bundled from the repo
header.php from the above .gif https://pastebin.com/fuekwb0g.
theme.json from the above .gif https://pastebin.com/Y2QSwW7N.
After theme modifications, steps to reproduce:

After the header template part has been replaced with the new header pattern, we can see that the new header DOES include the content from https://wordpress.org/patterns/pattern/contact-and-social-links/. However, when we visit the front end of the website, this specific content is missing. I then go and modify the template part that was automatically created and save changes, which seems to be the only way to make the additional content added by the pattern from the repo appear on the front end.
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes