Skip to main content
Glama

update_post

Modify an existing WordPress post by updating its title, content, or status using the WordPress MCP Server. Requires post ID and site credentials for authentication and customization.

Instructions

Update an existing WordPress post

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentNoNew post content
passwordNoWordPress password (overrides WORDPRESS_PASSWORD env var)
postIdYesPost ID to update
siteUrlNoWordPress site URL (overrides WORDPRESS_SITE_URL env var)
statusNoNew post status (draft, publish, etc.)
titleNoNew post title
usernameNoWordPress username (overrides WORDPRESS_USERNAME env var)

Implementation Reference

  • Executes the update_post tool by validating the postId parameter, conditionally adding title, content, or status to the update data, and performing a POST request to the WordPress REST API endpoint `/posts/{postId}` to update the post.
    case 'update_post': if (!params.postId) { throw new McpError( ErrorCode.InvalidParams, 'Post ID is required for updating a post' ); } const updateData: Record<string, any> = {}; if (params.title) updateData.title = params.title; if (params.content) updateData.content = params.content; if (params.status) updateData.status = params.status; const updateResponse = await client.post( `/posts/${params.postId}`, updateData ); return updateResponse.data;
  • Tool registration including name, description, and input schema definition for the update_post tool.
    { name: 'update_post', description: 'Update an existing WordPress post', inputSchema: { type: 'object', properties: { siteUrl: { type: 'string', description: 'WordPress site URL (overrides WORDPRESS_SITE_URL env var)', }, username: { type: 'string', description: 'WordPress username (overrides WORDPRESS_USERNAME env var)', }, password: { type: 'string', description: 'WordPress password (overrides WORDPRESS_PASSWORD env var)', }, postId: { type: 'number', description: 'Post ID to update', }, title: { type: 'string', description: 'New post title', }, content: { type: 'string', description: 'New post content', }, status: { type: 'string', description: 'New post status (draft, publish, etc.)', }, }, required: ['postId'], },
  • src/index.ts:58-165 (registration)
    Registration of the ListToolsRequestSchema handler that exposes the update_post tool in the tools list.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ { name: 'create_post', description: 'Create a new WordPress post', inputSchema: { type: 'object', properties: { siteUrl: { type: 'string', description: 'WordPress site URL (overrides WORDPRESS_SITE_URL env var)', }, username: { type: 'string', description: 'WordPress username (overrides WORDPRESS_USERNAME env var)', }, password: { type: 'string', description: 'WordPress password (overrides WORDPRESS_PASSWORD env var)', }, title: { type: 'string', description: 'Post title', }, content: { type: 'string', description: 'Post content', }, status: { type: 'string', description: 'Post status (draft, publish, etc.)', default: 'draft', }, }, required: ['title', 'content'], }, }, { name: 'get_posts', description: 'Get WordPress posts', inputSchema: { type: 'object', properties: { siteUrl: { type: 'string', description: 'WordPress site URL (overrides WORDPRESS_SITE_URL env var)', }, username: { type: 'string', description: 'WordPress username (overrides WORDPRESS_USERNAME env var)', }, password: { type: 'string', description: 'WordPress password (overrides WORDPRESS_PASSWORD env var)', }, perPage: { type: 'number', description: 'Number of posts per page', default: 10, }, page: { type: 'number', description: 'Page number', default: 1, }, }, }, }, { name: 'update_post', description: 'Update an existing WordPress post', inputSchema: { type: 'object', properties: { siteUrl: { type: 'string', description: 'WordPress site URL (overrides WORDPRESS_SITE_URL env var)', }, username: { type: 'string', description: 'WordPress username (overrides WORDPRESS_USERNAME env var)', }, password: { type: 'string', description: 'WordPress password (overrides WORDPRESS_PASSWORD env var)', }, postId: { type: 'number', description: 'Post ID to update', }, title: { type: 'string', description: 'New post title', }, content: { type: 'string', description: 'New post content', }, status: { type: 'string', description: 'New post status (draft, publish, etc.)', }, }, required: ['postId'], }, }, ], }));

Other Tools

Related Tools

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/Leonelberio/the-wordpress-mcp-server'

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