Skip to main content
Glama

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
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 delete.

Implementation Reference

  • 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)}`);
      }
    }
  • 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),
    },

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