Using the Create Block Theme plugin I inadvertently/accidentally choose the option to Save Synced Patterns.
This option comes with the notice.
Any synced patterns created in the Editor will be moved to the theme. Note that this will delete all synced patterns from the Editor and any references in templates will be made relative to the theme.
What it doesn’t tell you is that any use of the patterns as reusable blocks in posts, pages or other content will not be changed to refer to the theme’s pattern, and will therefore no longer work.
Problem resolution
There were 4 patterns exported, but the generated PHP gives no indication as to their original block ref nor from where the reusable block was referenced.
Step 1. Find the original patterns’ block refs
- Search for all occurrences of
wp:block. - For each post or page found, edit the post.
- Use the Code editor to find the pattern’s block ref.
- Attempt to work out from the context which pattern this represented.
Step 4. is a lot easier if you’re working on a staging site and you’ve got a working live site to refer to.
| Original block ref | Pattern title |
|---|---|
| 1553 | Join our meetup |
| 1487 | Refreshment other info sponsors |
| 1485 | Who Can Attend? |
| 1379 | Sponsor thankyou with links |
Step 2. Re-insert the patterns
In a new post, for each of the exported / deleted patterns
- Re-insert the pattern from the theme.
- Select all the blocks in the pattern.
- Create new pattern as a Synced pattern.
- Determine the new block ref for the synced pattern.
Those are the basic steps. They probably need fleshing out.
| Original block ref | New block ref |
|---|---|
| 1553 | 2703 |
| 1487 | 2717 |
| 1485 | 2719 |
| 1379 – note that this reusable block was referenced by 1487 | 2723 |
Step 3. Update the block refs across the site
For each block ref, use a plugin, such as Better Search Replace, to change the block refs from the Original block ref to the New block ref.
eg
From:
<!-- wp:block {"ref":1379} /-->To:
<!-- wp:block {"ref":2723} /-->