Get 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 →

Get a custom field value

Read-only
Meta Box Content & Tools meta-box/get-field-value

Retrieve the stored value of a Meta Box custom field for a post, term, user, comment, or settings page.

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 reads the current value Meta Box has stored for a custom field, identified by field_id, object_id, and object_type (post, term, user, setting, or comment; defaults to post). Internally it calls Meta Box's own rwmb_get_value() function, so the returned value is already unserialized and formatted the same way it would be inside a theme template — a scalar for a simple field, an array for a multiple or cloneable field, or a nested array of arrays when a field is both. Before allowing access, Meta Box confirms the field_id is actually a field it recognizes for that object; requests for arbitrary meta keys it doesn't manage are rejected. This lets an AI assistant pull structured custom-field data — pricing, specs, gallery images, relationship IDs — directly into a conversation instead of the user copying it out of the editor.

See it in action

You ask your AI assistant

"Get the value of the 'price' custom field for product post 128."

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.

Returns

An object with a single 'value' field containing the stored value, shaped according to the field's type and its multiple/clone settings (scalar, array, or array of arrays).

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 read-verb capability mapped from object_type: read_post for posts, assign_term for terms, or read for users, settings and 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.