feat(wordpress): add category/tag CRUD tools, fix delete-status and dead-field bugs#5360
feat(wordpress): add category/tag CRUD tools, fix delete-status and dead-field bugs#5360waleedlatif1 wants to merge 5 commits into
Conversation
…ead-field bugs
- Add wordpress_{get,update,delete}_category and _tag tools for full taxonomy parity
- Fix `deleted: data.deleted || true` always evaluating true across all 6 delete tools (posts/pages/media/comments/categories/tags)
- Remove dead `force` param from delete_media (endpoint always force-deletes; param had zero effect)
- Remove unwired `hideEmpty` block input
- Normalize search_content perPage/page visibility to user-or-llm for consistency
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Bug fixes and cleanup: delete tools use Minor: Reviewed by Cursor Bugbot for commit 3e54a46. Configure here. |
Greptile SummaryThis PR completes taxonomy CRUD parity for the WordPress integration by adding
Confidence Score: 5/5Safe to merge — all six delete tools now correctly propagate the API's deleted flag, and the six new taxonomy tools are cleanly integrated with no changes to existing tool IDs or output contracts. The changes are additive (new tools) plus targeted one-line bug fixes. No existing behavior is altered in a breaking way, the block wiring and registry registrations are complete and consistent, and the delete-status fix correctly applies ?? across every affected file. apps/sim/tools/wordpress/update_category.ts and update_tag.ts — truthy checks on optional string params mean empty-string values are silently dropped rather than forwarded to the API. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant UI as Block UI
participant Registry as Tool Registry
participant WP as WordPress.com API
Note over UI,WP: New Taxonomy CRUD Operations
UI->>Registry: wordpress_get_category(siteId, categoryId)
Registry->>WP: "GET /sites/{siteId}/categories/{id}"
WP-->>Registry: "{ id, name, slug, count, parent, ... }"
Registry-->>UI: "{ category: { ... } }"
UI->>Registry: wordpress_update_category(siteId, categoryId, name?, slug?, ...)
Registry->>WP: "POST /sites/{siteId}/categories/{id}"
WP-->>Registry: "{ id, name, slug, count, parent, ... }"
Registry-->>UI: "{ category: { ... } }"
UI->>Registry: wordpress_delete_category(siteId, categoryId)
Registry->>WP: "DELETE /sites/{siteId}/categories/{id}?force=true"
WP-->>Registry: "{ deleted: true, previous: { ... } }"
Registry-->>UI: "{ deleted: true, category: { ... } }"
Note over UI,WP: Same pattern mirrors for Tag operations
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant UI as Block UI
participant Registry as Tool Registry
participant WP as WordPress.com API
Note over UI,WP: New Taxonomy CRUD Operations
UI->>Registry: wordpress_get_category(siteId, categoryId)
Registry->>WP: "GET /sites/{siteId}/categories/{id}"
WP-->>Registry: "{ id, name, slug, count, parent, ... }"
Registry-->>UI: "{ category: { ... } }"
UI->>Registry: wordpress_update_category(siteId, categoryId, name?, slug?, ...)
Registry->>WP: "POST /sites/{siteId}/categories/{id}"
WP-->>Registry: "{ id, name, slug, count, parent, ... }"
Registry-->>UI: "{ category: { ... } }"
UI->>Registry: wordpress_delete_category(siteId, categoryId)
Registry->>WP: "DELETE /sites/{siteId}/categories/{id}?force=true"
WP-->>Registry: "{ deleted: true, previous: { ... } }"
Registry-->>UI: "{ deleted: true, category: { ... } }"
Note over UI,WP: Same pattern mirrors for Tag operations
Reviews (5): Last reviewed commit: "fix(wordpress): don't clear category/tag..." | Re-trigger Greptile |
…n delete_category/tag count and parent can legitimately be 0 (empty term, top-level category); || was dropping those values, same antipattern already fixed for `deleted` in this PR. Flagged independently by Greptile and Cursor Bugbot.
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 8cb03d7. Configure here.
…te tools Same || antipattern already fixed for category/tag delete tools was still present in delete_post/page/comment/media for id, author, featured_media, menu_order, parent, post — all legitimately 0 in common cases (no featured image, top-level page/comment). Found by a final independent validation pass.
|
@greptile review |
|
@cursor review |
…block param mapping Truthy check on params.categoryParent treated a resolved numeric 0 (root-level, no parent) as unset. Flagged by Cursor Bugbot on create_category/update_category.
|
@greptile review |
|
@cursor review |
…ield left blank description used !== undefined (numeric-field convention) instead of a truthy check (string-field convention used everywhere else in this codebase, e.g. update_post/update_page excerpt), so an untouched empty description field silently wiped existing text on every update. Flagged by Cursor Bugbot.
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 3e54a46. Configure here.
Summary
wordpress_{get,update,delete}_categoryandwordpress_{get,update,delete}_tagtools for full taxonomy CRUD parity (create/list already existed)deleted: data.deleted || truebug across all 6 delete tools (post/page/media/comment/category/tag) — the||operator meant the field could never reportfalse, even when a delete was trashed rather than force-deleted; changed to?? trueforceparam fromwordpress_delete_media— the endpoint always force-deletes (media has no trash), so the param had zero effect on the request; also dropped the corresponding UI togglehideEmptyblock input (no backing subblock or tool param)search_contentperPage/pagevisibility touser-or-llmfor consistency with other list toolsType of Change
Testing
Tested manually. Ran
bun run check:api-validation,bunx tsc --noEmit, andbiome checkclean on all changed/added files. Verified backward compatibility — no existing tool IDs, output fields, or required flags changed; only additions plus two confirmed-dead-code removals.Checklist