WordPress / WordPress/wordpress-importer
Shared block references aren't updated on import
Open
Nobody has claimed this yet.
[Type] Bug
- Dominant language
- PHP
- Stars
- 89
- Forks
- 96
- Avg merge
- 1h 13m
- Merged PRs (30d)
- 2
Description
In 5.0's block editor, shared block references (ex. <!-- wp:block {"ref":10} /-->) aren't updated when importing posts. The reference breaks when the shared block has a different post ID on the new site.
Steps to Reproduce
Original Site:
- Using the block editor, create several pages that reference the same shared block.
- Export the WXR file with all posts.
- Note the post ID of the
wp_blockpost for the shared block.
New Site:
- Make sure the post ID for the shared block is already taken by a different kind of post type. For example, if in the original site the shared block had a post ID of
10, make sure that exists (https://example.com/wp-admin/post.php?post=10&action=edit). - Import the WXR file.
- Attempt to edit the imported pages that reference the shared block.
--> Expected: Shared block is imported and the IDs of all shared block references are mapped correctly.
--> Actual: Shared block references are broken and unchanged with the ID from the originating site.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the WXR post-import path for shared blocks and how imported post IDs are mapped when page content is rewritten. Reproduce the collision described in the issue, then verify that every shared block reference in imported pages uses the new shared-block ID and that the pages remain editable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, content
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100