[Blueprints] Allow WXR imports to skip comments - #3880
Merged
Conversation
Contributor
There was a problem hiding this comment.
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?: booleanto theimportWxrstep API with a default oftrue. - 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Adds an
importCommentsoption to theimportWxrstep.importCommentstrueor omittedfalseThe 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.tsnpm exec nx run playground-blueprints:typechecknpm exec nx run playground-blueprints:lintnpm exec nx run playground-blueprints:build:blueprint-schemanpm run format:uncommittedgit diff --checkPart of #2592.