Added custom taxonomy support and WP migration improvements#1641
Added custom taxonomy support and WP migration improvements#1641
Conversation
55sketch
commented
Mar 19, 2026
- Added --customTaxonomies flag to wp-api and wp-xml commands to import custom taxonomy terms as Ghost tags
- Handled custom taxonomies differently per package: wp-api uses wp:term embedded data, wp-xml uses category domain attributes
- Batched processPosts in wp-api to avoid memory issues on large sites
- Replaced concat with spread in wp-api fetch for better performance
- Added Podigee podcast player embed support in wp-api processor
- Guarded against null/undefined YouTube URLs in mg-utils
- Added tests for custom taxonomy handling in both wp-api and wp-xml
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
WalkthroughAdds support for importing specified WordPress custom taxonomies as Ghost tags by extending processing to accept Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can validate your CodeRabbit configuration file in your editor.If your editor has YAML language server, you can enable auto-completion and validation by adding |
ed5d340 to
ad91373
Compare
- Added --customTaxonomies flag to wp-api and wp-xml commands to import custom taxonomy terms as Ghost tags - Handled custom taxonomies differently per package: wp-api uses wp:term embedded data, wp-xml uses category domain attributes - Batched processPosts in wp-api to avoid memory issues on large sites - Replaced concat with spread in wp-api fetch for better performance - Added Podigee podcast player embed support in wp-api processor - Guarded against null/undefined YouTube URLs in mg-utils - Added tests for custom taxonomy handling in both wp-api and wp-xml
ad91373 to
7c9936e
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/mg-wp-api/lib/processor.js (1)
133-146:⚠️ Potential issue | 🟡 MinorNormalize the custom taxonomy allow-list.
Line 145 is independent from the
category/post_tagbranches above, so passing either built-in taxonomy here will emit duplicate Ghost tags. Converting the allow-list to an exact-matchSetand filtering out the built-ins closes that hole.Suggested fix
- const allowedCustomTaxonomies = customTaxonomies || []; + const allowedCustomTaxonomies = new Set( + (Array.isArray(customTaxonomies) ? customTaxonomies : String(customTaxonomies ?? '').split(',')) + .map((taxonomy) => taxonomy.trim()) + .filter(Boolean) + .filter((taxonomy) => !['category', 'post_tag'].includes(taxonomy)) + ); @@ - if (allowedCustomTaxonomies.includes(term.taxonomy)) { + if (allowedCustomTaxonomies.has(term.taxonomy)) { customTerms.push(processTerm(term)); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/mg-wp-api/lib/processor.js` around lines 133 - 146, The current loop pushes built-in taxonomies twice because allowedCustomTaxonomies is treated as an array and checked after the category/post_tag branches; change the handling of allowedCustomTaxonomies to a Set for exact-match lookups and ensure you explicitly exclude the built-ins ('category' and 'post_tag') before adding to customTerms: convert customTaxonomies to a Set (e.g., allowedCustomTaxonomiesSet) and replace the includes check in the wpTerms.forEach loop with a Set.has check and an explicit guard that term.taxonomy !== 'category' && term.taxonomy !== 'post_tag' when deciding to push processTerm(term) into customTerms.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/mg-wp-api/lib/processor.js`:
- Around line 703-712: The current loop in
parsed.$('script.podigee-podcast-player') interpolates configUrl into a string
(embedHTML) and passes it to replaceWith, which risks breaking markup; instead,
construct a real element tree: read configUrl from
el.getAttribute('data-configuration'), create an iframe element node and set its
src, style, frameborder, and scrolling attributes via the DOM/cheerio API (not
string concatenation), then wrap that iframe node with the surrounding HTML
comment nodes ("<!--kg-card-begin: html-->" and "<!--kg-card-end: html-->") or
their equivalent node types, serialize that node tree to HTML, and pass the
serialized output to replaceWith(el, ...). Use the same identifiers (configUrl,
el, replaceWith) so the change is isolated to this loop.
---
Outside diff comments:
In `@packages/mg-wp-api/lib/processor.js`:
- Around line 133-146: The current loop pushes built-in taxonomies twice because
allowedCustomTaxonomies is treated as an array and checked after the
category/post_tag branches; change the handling of allowedCustomTaxonomies to a
Set for exact-match lookups and ensure you explicitly exclude the built-ins
('category' and 'post_tag') before adding to customTerms: convert
customTaxonomies to a Set (e.g., allowedCustomTaxonomiesSet) and replace the
includes check in the wpTerms.forEach loop with a Set.has check and an explicit
guard that term.taxonomy !== 'category' && term.taxonomy !== 'post_tag' when
deciding to push processTerm(term) into customTerms.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4ceb5e0f-ec4f-474b-a115-ef607ac65979
📒 Files selected for processing (9)
packages/mg-utils/src/lib/youtube-utils.tspackages/mg-utils/src/test/youtube-utils.test.tspackages/mg-wp-api/lib/fetch.jspackages/mg-wp-api/lib/processor.jspackages/mg-wp-api/test/process.test.jspackages/mg-wp-xml/lib/process.jspackages/mg-wp-xml/test/process.test.jspackages/migrate/commands/wp-api.jspackages/migrate/commands/wp-xml.js
✅ Files skipped from review due to trivial changes (5)
- packages/migrate/commands/wp-xml.js
- packages/mg-wp-xml/lib/process.js
- packages/mg-wp-api/lib/fetch.js
- packages/mg-wp-xml/test/process.test.js
- packages/mg-wp-api/test/process.test.js
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/migrate/commands/wp-api.js
- packages/mg-utils/src/lib/youtube-utils.ts