Skip to main content
Glama

wp_create_post

Create and publish WordPress posts with customizable content, status, and excerpts using the WordPress REST API.

Instructions

Create a new WordPress post.

Args: title: The title of the post. content: The content/body of the post (supports HTML and Gutenberg blocks). status: Post status - 'draft', 'publish', 'pending', 'private'. Default is 'draft'. excerpt: Optional excerpt/summary of the post. Returns: Created post with id, title, status, date, and link.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes
contentYes
statusNodraft
excerptNo

Implementation Reference

  • Handler function for the 'wp_create_post' tool, including registration via @mcp.tool() decorator and input schema via type hints and docstring. Delegates to WordPressClient.create_post.
    @mcp.tool() def wp_create_post( title: str, content: str, status: str = "draft", excerpt: str | None = None, ) -> dict: """Create a new WordPress post. Args: title: The title of the post. content: The content/body of the post (supports HTML and Gutenberg blocks). status: Post status - 'draft', 'publish', 'pending', 'private'. Default is 'draft'. excerpt: Optional excerpt/summary of the post. Returns: Created post with id, title, status, date, and link. """ client = get_client() return client.create_post(title=title, content=content, status=status, excerpt=excerpt)
  • Core helper method in WordPressClient that constructs the POST data and calls the WordPress REST API to create the post.
    def create_post( self, title: str, content: str, status: str = "draft", excerpt: str | None = None, ) -> dict: """Create a new post.""" data = { "title": title, "content": content, "status": status, } if excerpt: data["excerpt"] = excerpt post = self._post("posts", 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