-
Notifications
You must be signed in to change notification settings - Fork 25
Add --skip_authors and --skip_terms as additional flags #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds functionality to skip authors and terms (categories, tags, custom taxonomy terms, and nav menu terms) from WordPress export files. The implementation follows the existing pattern used by the --skip_comments flag.
Key Changes:
- Added
--skip_authorsand--skip_termscommand-line flags - Implemented exclusion mechanism in
WP_Export_Split_Files_Writerto filter out specified sections - Modified
before_posts()method signature to accept available sections parameter
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Export_Command.php | Added CLI parameters and validation methods for --skip_authors and --skip_terms flags, populating the $exclude array based on user input |
| src/WP_Export_Split_Files_Writer.php | Implemented section exclusion logic and updated before_posts() call to pass filtered sections |
| features/export.feature | Added test scenarios for the new skip flags |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if ( ! empty( $writer_args['exclude'] ) ) { | ||
| foreach ( $writer_args['exclude'] as $exclude ) { | ||
| $key = array_search( $exclude, $this->available_sections, true ); | ||
| if ( false !== $key ) { | ||
| unset( $this->available_sections[ $key ] ); | ||
| } | ||
| } | ||
| } |
Copilot
AI
Nov 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exclusion logic removes sections from $this->available_sections after it has already been used to calculate $this->subsequent_sections (line 45). This means excluded sections will still be present in subsequent files when using --include_once. The exclusion logic should be moved before line 44 to ensure excluded sections are properly removed from both $this->available_sections and $this->subsequent_sections.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This PR introduces
--skip_authorsand--skip_termsflags forwp exportcommand.Fixes: #72