wp_delete_category
Remove a category from a WordPress site by specifying its ID, enabling content organization cleanup and taxonomy management.
Instructions
Deletes a category.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site | No | The ID of the WordPress site to target (from mcp-wordpress.config.json). Required if multiple sites are configured. | |
| id | Yes | The ID of the category to delete. |
Implementation Reference
- src/tools/taxonomies.ts:238-246 (handler)The handler function that implements the core logic of the wp_delete_category tool by calling deleteCategory on the WordPressClient.public async handleDeleteCategory(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> { const { id } = params as { id: number }; try { await client.deleteCategory(id); return `✅ Category ${id} has been deleted.`; } catch (_error) { throw new Error(`Failed to delete category: ${getErrorMessage(_error)}`); } }
- src/tools/taxonomies.ts:100-112 (registration)Registers the wp_delete_category tool in the TaxonomyTools.getTools() array, including schema (parameters) and handler reference.{ name: "wp_delete_category", description: "Deletes a category.", parameters: [ { name: "id", type: "number", required: true, description: "The ID of the category to delete.", }, ], handler: this.handleDeleteCategory.bind(this), },