Skip to main content
Glama

Set post meta

wp_update_post_meta
Destructive

Create or overwrite a post’s meta value by post ID and key, replacing existing values for that key; any JSON value is accepted, while protected or credential-like keys are refused.

Instructions

Create or overwrite one meta value of a post: every stored value of the key is replaced, so a repeated call leaves the same state. Takes id, key and value (any JSON value; an array or object is stored as a serialized array); the key is stored lower-cased (sanitize_key). Refused: keys starting with "_", credential-like keys and keys the account may not edit. Page-builder data — keys such as panels_data, dslc_code, pagelayer-data, brizy, mfn-page-items or tve_updated_post (filter ab_mcp_builder_markup_meta_keys) — takes the unfiltered_html capability, which on a multisite network only a super admin has. The value is stored as given, backslashes included (\u0026 in block JSON stays \u0026). Returns updated, id and key; an unknown post is a not-found error. Needs edit_posts and the right to edit the post; no undo point is recorded. wp_get_post_meta reads the value; wp_update_post sets several keys through its meta field.

Input Schema

NameRequiredDescriptionDefault
idYesPost id.
keyYesMeta key; stored lower-cased (sanitize_key).
valueNoAny JSON value; an array or object is stored serialized. Omitted: an empty string.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv4.10.0

TDQS

A4.2/5.0
Behavior2/5

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

Most of the disclosure is excellent — replacement of all prior values, sanitize_key lower-casing, serialization of arrays/objects, preserved backslashes, no undo point, and edit_posts requirement. However, 'a repeated call leaves the same state' asserts idempotency while the annotations declare idempotentHint=false, an inconsistency an agent could rely on incorrectly.

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?

Core overwrite semantics come first, then parameters, refusals, capability requirements and return shape. It is dense but nearly every clause carries operational meaning; the parenthetical filter name and capability paragraph run long, but are not padding.

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?

No output schema exists, and the description covers the return payload (updated, id, key), the not-found error for unknown posts, permission prerequisites, refused key classes and the lack of an undo point — everything needed to call it safely.

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 already 100%, so the baseline is 3; the description goes beyond it by spelling out that arrays/objects are stored as serialized arrays and that backslashes (e.g. \u0026 in block JSON) survive unchanged, which affects how callers must encode values.

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 ('Create or overwrite one meta value of a post') and immediately pins the overwrite scope ('every stored value of the key is replaced'). It is clearly separable from wp_get_post_meta (read) and wp_update_post (multi-key meta field), both named explicitly.

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?

Gives explicit routing: use wp_get_post_meta to read, use wp_update_post when setting several keys through its meta field. It also states the exclusions up front (underscore-prefixed keys, credential-like keys, keys the account may not edit) plus the capability needed for page-builder keys.

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