-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Synced patterns/Reusable blocks: exporting the theme breaks synced patterns #53806
Comments
I can't find the issue right now, but the Navigation block has the same problem. This is a general bug with any synced block using database IDs as ref. |
true, but for the nav block removing the ID from the block makes it fall back to a list of pages, and the ref is pointing to content. In the case of patterns, we are talking about markup, that is supposed to be part of the theme, not specific to the content of the user's site. |
Thanks for clarifying, @MaggieCabrera! |
Heads up to @WordPress/block-themers! |
I think the solution for this (same as the navigation block) is for the pattern block to reference patterns using a slug instead of an id. It's discussed in the following two issues:
Though I think there would still be additional work to make sure the referenced synced patterns are exported as files. |
I just took care of this in a plugin of mine, it could be incorporated into the import / export tool if necessary. One thing that it took me more than 10 years to realize is that the import / export tool tries to keep ids, and referential integrity is only lost when the id is already used by another item. I mentioned it in another issue: #62566 (comment) |
Description
If you build a theme using reusable blocks and then export the theme (both using the core functionality or Create Block theme plugin) the template exported will have the synced patterns as
<!-- wp:block {"ref":62} /-->
which will not work if you try to run the theme on a different environment. We should fix this, even if it's just resolving those refs into the referenced markup of the pattern upon exporting.Step-by-step reproduction instructions
Create a synced pattern on one of the theme's templates.
Export the theme
Try installing that theme on a different environment, you will see what's on the screenshot below
Screenshots, screen recording, code snippet
Environment info
No response
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
The text was updated successfully, but these errors were encountered: