Skip to main content
Glama

wp_update_category

Modify an existing WordPress category by updating its name or other properties using the category ID.

Instructions

Updates an existing category.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoThe ID of the WordPress site to target (from mcp-wordpress.config.json). Required if multiple sites are configured.
idYesThe ID of the category to update.
nameNoThe new name for the category.

Implementation Reference

  • Registration of the 'wp_update_category' tool within TaxonomyTools.getTools(), including name, description, input parameters schema, and handler binding.
    { name: "wp_update_category", description: "Updates an existing category.", parameters: [ { name: "id", type: "number", required: true, description: "The ID of the category to update.", }, { name: "name", type: "string", description: "The new name for the category.", }, ], handler: this.handleUpdateCategory.bind(this),
  • The core handler function for the 'wp_update_category' tool. Casts input parameters to UpdateCategoryRequest type and invokes the WordPressClient's updateCategory method, handling success and error responses.
    public async handleUpdateCategory(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> { const updateParams = params as unknown as UpdateCategoryRequest; try { const category = await client.updateCategory(updateParams); return `✅ Category ${category.id} updated successfully.`; } catch (_error) { throw new Error(`Failed to update category: ${getErrorMessage(_error)}`); } }
  • TypeScript interface definitions for category requests. UpdateCategoryRequest (extends Partial<CreateCategoryRequest> with required id) provides input schema validation for the tool handler.
    export interface CreateCategoryRequest { name: string; description?: string; slug?: string; parent?: number; meta?: WordPressMeta; } export interface UpdateCategoryRequest extends Partial<CreateCategoryRequest> { id: number; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/docdyhr/mcp-wordpress'

If you have feedback or need assistance with the MCP directory API, please join our Discord server