Skip to main content
Glama

Change a post or page

wp_update_post
Destructive

Update an existing post, page, or custom post type by changing only the fields you pass; use it to edit content, status, metadata, terms, or scheduling without rewriting the whole entry.

Instructions

Update an existing post, page or entry of any post type; only the fields passed change. Returns {updated: true, post} with the entry's summary (the fields of wp_list_posts), plus builder_note where the new content shows but the page builder may replace it later, and undo. Needs the right to edit the entry; moving it to publish, private or future needs the right to publish. Changes to a published entry show on the site at once; a status change can publish an entry or take it off the site, and giving a trashed entry a status takes it out of the trash. For a revision id, WordPress stores custom fields (meta) on the post the revision belongs to. On a page whose page builder shows its own data, post_content is only a copy: a call with content is refused there before anything is written, with the way to make the change; a call without content still changes the other fields. wp_get_builder_layout returns the outline of such pages. An undo point keeps the previous values of the fields the call changes (title, content, excerpt, status, slug, parent, author, date; with the status also the date, since publishing an undated draft dates it), read just before the write; meta and terms are not part of it. The answer adds undo, the token for wp_undo (null when no snapshot could be taken).

Input Schema

NameRequiredDescriptionDefault
idYesPost id.
dateNoNew publish date. Site time as "Y-m-d H:i:s" (or "Y-m-d H:i", "Y-m-d"), or RFC 3339 with an offset, the form of the dates this plugin returns, e.g. "2026-10-02T09:00:00+02:00". Times that do not exist in the site's timezone (clocks skip them) are refused, as is a time where the clocks go back that WordPress would read as the other of the two. A date alone never changes the status: a save that would publish the post or take it off the site is refused unless that status is passed as well, and a post is scheduled only for a date at least five minutes ahead.
metaNoKey/value custom fields to set. Keys are stored as sanitize_key() writes them (lower case; letters, digits, _ and -). Keys starting with "_", protected or credential-like keys and keys the account may not edit are skipped without an error. Page-builder data (keys such as panels_data, dslc_code or pagelayer-data; filter ab_mcp_builder_markup_meta_keys) takes the unfiltered_html capability, which on a multisite network only a super admin has; without it the call is refused before anything is written.
slugNoNew URL slug; it changes the permalink where the permalink structure uses slugs. When omitted, it stays as it is.
termsNoTaxonomy => array of term ids or names, e.g. {"post_tag":["News"]}. Replaces the post's terms in each taxonomy given; other taxonomies keep theirs. A name that does not exist yet is created where the account may manage the taxonomy's terms, else left out; a taxonomy whose list holds a term the account may not assign (assign_term) keeps its terms; unknown taxonomies and taxonomies the account may not assign are skipped without an error.
titleNoNew title. When omitted, it stays as it is.
authorNoNew author user id. Applied only for an account that may edit others' entries of this type; otherwise left as it is.
parentNoNew parent post id; 0 for none. When omitted, it stays as it is.
statusNodraft, publish, pending, private, future. "future" needs a date at least five minutes ahead. When omitted, the status stays; on a trashed entry any of these takes it out of the trash.
contentNoNew content (HTML or block markup); it replaces the whole post_content. When omitted, it stays as it is.
excerptNoNew excerpt. When omitted, it stays as it is.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv4.7.0

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the annotations: names the required capabilities (edit entry, publish), states that published changes appear immediately and that status changes can publish or unpublish or untrash, discloses the builder-page write refusal, the revision-id meta quirk, and exactly which fields the undo snapshot captures (meta and terms excluded). That is unusually rich behavioral disclosure for a destructive mutation.

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?

Front-loads purpose and return shape before the caveats, and almost every sentence carries distinct information. The dense run-on sentences around the builder and undo sections could be split for faster scanning, which keeps it off a 5.

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?

For an 11-parameter destructive tool with nested objects and no output schema, the description supplies the return shape ({updated, post, builder_note, undo}), the permission model, failure modes, and undo scope. Nothing an agent needs before calling is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3; the description still adds cross-parameter semantics the schema cannot express, notably the undo field list (title, content, excerpt, status, slug, parent, author, date, plus date on status change) and the fact that meta/terms fall outside the snapshot.

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?

States a specific verb and resource ('update an existing post, page or entry of any post type') and immediately clarifies the partial-update semantics ('only the fields passed change'), which is the key differentiator from wp_create_post and from full-replace operations. It also names siblings it interacts with (wp_get_builder_layout, wp_undo).

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

Usage Guidelines4/5

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

Gives clear conditions: for page-builder pages, content writes are refused and wp_get_builder_layout is the answer; for reverting, use wp_undo with the returned token; a revision id redirects meta to the parent post. What's missing is guidance on when to use this versus wp_update_post_meta or wp_bulk_update_status for the same effect.

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

Deploy Server

Other Tools