Skip to content

[Blueprints] Allow WXR imports to skip comments - #3880

Merged
adamziel merged 1 commit into
trunkfrom
add-import-wxr-comments-option
Jul 3, 2026
Merged

[Blueprints] Allow WXR imports to skip comments#3880
adamziel merged 1 commit into
trunkfrom
add-import-wxr-comments-option

Conversation

@adamziel

@adamziel adamziel commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

What?

Adds an importComments option to the importWxr step.

importComments Behavior
true or omitted Keep the current behavior: import comments from the WXR file.
false Skip comments while importing posts/pages from the WXR file.

The public Blueprint schema is regenerated to include the new option.

Why?

Blueprint v2 already models comment import control for WXR content. This adds the low-level v1 step behavior that the future v2 runner can map to, while keeping existing v1 behavior unchanged.

This stays separate from SQL URL replacement and from broader WXR controls like users, author mapping, site options, and explicit URL maps.

Testing

  • npm exec nx run playground-blueprints:test:vite -- --testFiles=packages/playground/blueprints/src/tests/steps/import-wxr.spec.ts
  • npm exec nx run playground-blueprints:typecheck
  • npm exec nx run playground-blueprints:lint
  • npm exec nx run playground-blueprints:build:blueprint-schema
  • npm run format:uncommitted
  • git diff --check

Part of #2592.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds an importComments option to the importWxr blueprint step, enabling callers to skip importing comments from WXR files while preserving the existing default behavior (import comments). The public Blueprint schema is regenerated to reflect the new option.

Changes:

  • Added importComments?: boolean to the importWxr step API with a default of true.
  • Wired the option into the default WXR importer via an env var + WordPress importer filter to skip comments.
  • Added a unit/integration test and regenerated blueprint-schema.json.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/playground/blueprints/src/lib/steps/import-wxr.ts Introduces importComments option and applies it in the importer execution.
packages/playground/blueprints/src/tests/steps/import-wxr.spec.ts Adds coverage verifying comment import can be skipped.
packages/playground/blueprints/public/blueprint-schema.json Regenerates schema to include importComments.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +135 to +137
if (getenv('IMPORT_COMMENTS') === 'false') {
add_filter('wp_import_post_comments', '__return_empty_array');
}
'numberposts' => 1,
]);
$post = $posts ? $posts[0] : null;
echo json_encode($post ? count(get_comments(['post_id' => $post->ID])) : null);
@adamziel
adamziel merged commit 2cb959f into trunk Jul 3, 2026
151 of 153 checks passed
@adamziel
adamziel deleted the add-import-wxr-comments-option branch July 3, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment