Skip to main content
Glama

wp_update_post

Modify existing WordPress posts by updating title, content, status, or excerpt using the post ID. This tool helps maintain current content and manage publishing workflows.

Instructions

Update an existing WordPress post.

Args: post_id: The ID of the post to update. title: New title (optional). content: New content (optional). status: New status - 'draft', 'publish', 'pending', 'private', 'trash' (optional). excerpt: New excerpt (optional). Returns: Updated post with id, title, status, date, and link.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
post_idYes
titleNo
contentNo
statusNo
excerptNo

Implementation Reference

  • MCP tool handler function for 'wp_update_post'. Includes input schema via type hints and docstring, registered using @mcp.tool() decorator, delegates to WordPressClient.update_post.
    @mcp.tool() def wp_update_post( post_id: int, title: str | None = None, content: str | None = None, status: str | None = None, excerpt: str | None = None, ) -> dict: """Update an existing WordPress post. Args: post_id: The ID of the post to update. title: New title (optional). content: New content (optional). status: New status - 'draft', 'publish', 'pending', 'private', 'trash' (optional). excerpt: New excerpt (optional). Returns: Updated post with id, title, status, date, and link. """ client = get_client() return client.update_post( post_id=post_id, title=title, content=content, status=status, excerpt=excerpt )
  • Core implementation logic in WordPressClient.update_post method: constructs update data, performs POST to WP REST API endpoint /posts/{post_id}, returns simplified post info.
    def update_post( self, post_id: int, title: str | None = None, content: str | None = None, status: str | None = None, excerpt: str | None = None, ) -> dict: """Update an existing post.""" data = {} if title is not None: data["title"] = title if content is not None: data["content"] = content if status is not None: data["status"] = status if excerpt is not None: data["excerpt"] = excerpt if not data: raise ValueError("At least one field must be provided to update") post = self._post(f"posts/{post_id}", data) return { "id": post["id"], "title": post["title"]["rendered"], "status": post["status"], "date": post["date"], "link": post["link"], }

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/gaupoit/wordpress-mcp'

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