WordPress / WordPress/wordpress-importer

Shared block references aren't updated on import

Open
#44 0 comments 1 reaction 0 assignees View on GitHub

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:

  1. Using the block editor, create several pages that reference the same shared block.
  2. Export the WXR file with all posts.
  3. Note the post ID of the wp_block post for the shared block.

New Site:

  1. 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).
  2. Import the WXR file.
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.