Skip to main content
Glama

wp_create_post

Create a new WordPress post from scratch on a configured site. Supply content as raw markup or block array; returns the new post ID. Works on local or production with confirmation.

Instructions

Create a NEW post from scratch on a configured site, with the body carried content-safe (base64 in code) — so you never have to hand-quote multi-line block markup into a wp post create command or write a throwaway PHP file into the container just to author a post. Returns the new post's ID (new_id), which you then build up compositionally with wp_block (insert / update-attrs). Supply the body EITHER as content (a raw post_content markup string) OR as blocks (an array of block specs — raw markup strings and/or {name, data} objects — serialized server-side with serialize_blocks() so self-closing ACF blocks and inner blocks stay byte-faithful); omit both for an empty post. fields sets any additional post columns (post_excerpt, post_author, post_parent, menu_order, post_name, ...). The new post is re-read and its content md5 is compared to the intended body (verified). Content never passes through the caller's text. Creating on target='production' requires confirm=true when PROD_GUARD is enabled. To COPY an existing post across environments use wp_clone_post instead; this tool authors a brand-new post from given values.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
envNoTerminus environment override (e.g. 'dev', 'test', 'live') for target='production' on a Terminus site. Omit for the site's TERMINUS_ENV.
siteNoWhich configured site to target (matches a [site:NAME] section in wp-cli.conf). Omit for DEFAULT_SITE or the sole site.
titleNoThe post title (post_title). Optional.
blocksNoArray of block specs to serialize as the initial body: each item is raw block markup (string) OR an object {"name": "acf/...", "data": {field: value}}. Serialized server-side via serialize_blocks(). Mutually exclusive with 'content'.
fieldsNoOptional additional post fields to set (e.g. {"post_excerpt":"...","post_author":2,"post_parent":10,"menu_order":3,"post_name":"slug"}).
statusNoPost status (e.g. 'draft', 'publish', 'private'). Default 'draft'.draft
targetNoWhere to create the post. 'local' = Docker container (default). 'production' = remote environment; transport (Terminus vs SSH) is chosen by the site's conf.local
confirmNoRequired to create on a production site when the guard is enabled. Default: false.
contentNoRaw post_content markup (a full block document). Mutually exclusive with 'blocks'. Omit both for an empty post.
post_typeNoPost type to create (e.g. 'post', 'page', a CPT slug). Default 'post'.post
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It discloses base64 encoding, md5 verification, production guard requirement, and that content never passes through caller's text. Could mention the exact return value (new_id) more explicitly but implied.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is relatively long but every sentence serves a purpose, front-loading the main action. Slightly lengthy due to comprehensive details, but still efficient for the complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 10 parameters, no output schema, and full schema coverage, the description provides sufficient context: content options, production guard, return value, and compositional workflow. No gaps identified.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, yet description adds critical context: mutual exclusivity of content/blocks, server-side serialization of blocks, base64 handling, and workflow with wp_block. Significantly enriches parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool creates a new post from scratch, distinguishes from sibling tool wp_clone_post (which copies existing posts), and specifies how content is supplied (content vs blocks).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to use this tool versus wp_clone_post, mentions required confirm=true for production guard, and gives guidance on mutually exclusive content parameters and composition with wp_block.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/EarthmanWeb/mcp-wp-cli-terminus'

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