Update (or create) a custom field value is a WordPress ability from Meta Box — usable via Easy MCP AI, which connects Claude, ChatGPT, and any AI assistant to your site.

Install Free Plugin →

Update (or create) a custom field value

Write
Meta Box Content & Tools meta-box/update-field-value

Set the value of a Meta Box custom field, creating it if it doesn't already exist yet.

Requires the Meta Box plugin on WordPress 6.9+ for the Abilities API (abilities are registered only when the wp_register_ability() function exists). The get, update, and delete abilities additionally require the target key to be a field Meta Box actually recognizes (verified via rwmb_get_field_settings) and the current user to hold the WordPress capability mapped from object_type: read_post/edit_post for posts, assign_term/edit_term for terms, read/edit_user for users, read/manage_options for settings pages, and read/moderate_comments for comments.

What it does

This ability writes a value to a Meta Box custom field identified by field_id, object_id and object_type, and it's idempotent — calling it again with the same value just re-saves it. It first resolves the field's real settings via rwmb_get_field_settings (failing with success: false if the field isn't registered for that object), normalizes the supplied value against those settings, and then persists it through rwmb_set_meta(), so it goes through the same save path a Meta Box form submission would use, including multiple/clone wrapping. Because Meta Box field types expect different value shapes — a plain string for a text field, an array for a checkbox_list, a nested array for a cloneable group — an AI assistant should call meta-box/get-field-value-format first to confirm the exact shape before sending value here.

See it in action

You ask your AI assistant

"Set the 'price' custom field on product post 128 to 49.99."

Inputs

Name Type Required Description
field_id string Yes The custom field meta key.
object_id integer|string Yes The object ID (post, term, user ID, or settings page slug).
object_type string No The object type the field belongs to: post, term, user, setting, or comment. Defaults to post.
value mixed Yes The value to store. Use meta-box/get-field-value-format first to confirm the expected shape for this field.

Returns

An object with a single 'success' boolean indicating whether the value was saved. Returns false when field_id doesn't resolve to a Meta Box field registered for that object.

Permission

The field_id must resolve to a field Meta Box actually recognizes for that object (checked via rwmb_get_field_settings). The current user must also hold the write-verb capability mapped from object_type: edit_post for posts, edit_term for terms, edit_user for users, manage_options for settings, or moderate_comments for comments.

Newsletter

The AI + WordPress space moves fast. Keep up.

New tools, workflow ideas, and product updates — be the first to know what's next.

No spam, unsubscribe anytime.