Skip to main content
Glama

wp_update_page

Modify existing WordPress pages by updating content, titles, or status through the MCP WordPress Server. Change page details without creating new content.

Instructions

Updates an existing page.

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 page to update.
titleNoThe new title for the page.
contentNoThe new content for the page, in HTML format.
statusNoThe new status for the page.

Implementation Reference

  • The main handler function for the wp_update_page tool. It casts parameters to UpdatePageRequest type, calls the WordPressClient's updatePage method, and returns a success message or throws an error.
    public async handleUpdatePage(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> { const updateParams = params as unknown as UpdatePageRequest & { id: number }; try { const page = await client.updatePage(updateParams); return `✅ Page ${page.id} updated successfully.`; } catch (_error) { throw new Error(`Failed to update page: ${getErrorMessage(_error)}`); } }
  • The tool registration object returned by PageTools.getTools(), defining the name, description, input parameters schema, and binding to the handleUpdatePage handler. This is collected by ToolRegistry and registered with the MCP server.
    { name: "wp_update_page", description: "Updates an existing page.", parameters: [ { name: "id", type: "number", required: true, description: "The ID of the page to update.", }, { name: "title", type: "string", description: "The new title for the page.", }, { name: "content", type: "string", description: "The new content for the page, in HTML format.", }, { name: "status", type: "string", description: "The new status for the page.", enum: ["publish", "draft", "pending", "private"], }, ], handler: this.handleUpdatePage.bind(this), },
  • TypeScript interface defining the input shape for updating a page, extending CreatePageRequest with required id. Used for type safety in the handler.
    export interface UpdatePageRequest extends Partial<CreatePageRequest> { 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