Update ACF Block Fields
Changes field values of one ACF block inside a post, the way editing the block in the block editor and saving does: only the fields sent change, every other block and every other field is kept, and each value is checked by ACF's own validation (required, choices, limits) before anything is written; the whole call is refused if one value is wrong. Values use the raw form mosmcp/acf-get-block-fields returns. The post is saved through WordPress, so a revision is kept and the change is reversible by sending the previous values back (they are returned). Refused when someone else is editing the post right now, or when content_hash no longer matches. HTML you are not allowed to post is removed by WordPress, as in the editor. Call mosmcp/acf-get-block-fields first for block_index and field names.
Also known as: edit block, change hero text, update block content, set ACF block field.
| Property | Value |
|---|---|
| Ability slug | mosmcp/acf-update-block-fields |
| Wire tool name | mosmcp__acf-update-block-fields |
| Category | ACF PRO (mosmcp-acf) |
| Plan | Pro |
Required access
| Requirement | Value |
|---|---|
| Capability | edit_post (checked against the specific post) |
| Minimum default role | Contributor |
| Annotations | readOnly: false · destructive: false · idempotent: true · openWorld: false |
Input schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| post_id | integer (min 1) | Yes | — | The ID of the post, page or custom post type item, as returned by mosmcp/post-find, mosmcp/page-find or mosmcp/cpt-list. |
| block_index | integer (min 0) | Yes | — | Which ACF block to change: its block_index from mosmcp/acf-get-block-fields (0 = the first ACF block in the post). |
| block_name | string | — | Optional safety check: the block name expected at that position, for example "acf/hero". The call is refused if a different block is there. | |
| values | object | Yes | — | Field name or field key => new value, in the raw form mosmcp/acf-get-block-fields returns. Only the fields sent change. An empty string clears a text field. |
| expected_content_hash | string | — | Optional content_hash from mosmcp/acf-get-block-fields. If the post has changed since, nothing is written. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| post_id | integer | Yes | |
| block_index | integer | Yes | |
| block_name | string | ||
| changed | boolean | Yes | Whether any stored value changed. |
| fields | object[] | Yes | |
| fields[].key | string | Yes | |
| fields[].name | string | Yes | |
| fields[].type | string | ||
| fields[].previous | string | number | integer | boolean | array | object | null | The value stored before this call. Send it back to undo. | |
| fields[].current | string | number | integer | boolean | array | object | null | The value stored now, read back from the saved post. | |
| fields[].changed | boolean | Yes | |
| content_hash | string | The post content's fingerprint after the change. | |
| edit_url | string | ||
| notes | string[] |
Example
Sample prompt
In the testimonial block on the Home page (post 42), change the quote to 'They rebuilt our booking site in ten days, and online bookings doubled.' and the rating to 5 stars.
Example request (json)
{
"jsonrpc": "2.0",
"id": 568,
"method": "tools/call",
"params": {
"name": "mosmcp__acf-update-block-fields",
"arguments": {
"input": {
"post_id": 42,
"block_index": 1,
"block_name": "acf/testimonial",
"values": {
"quote": "They rebuilt our booking site in ten days, and online bookings doubled.",
"rating": "5"
},
"expected_content_hash": "3f9a1c7e5b2d48a6c0e1f7b9d4a2c815"
}
}
}
}Example response (json)
{
"jsonrpc": "2.0",
"id": 568,
"result": {
"isError": false,
"structuredContent": {
"post_id": 42,
"block_index": 1,
"block_name": "acf/testimonial",
"changed": true,
"fields": [
{
"key": "field_6532a1f0c1a01",
"name": "quote",
"type": "textarea",
"previous": "Their team rebuilt our booking site in two weeks.",
"current": "They rebuilt our booking site in ten days, and online bookings doubled.",
"changed": true
},
{
"key": "field_6532a1f0c1a04",
"name": "rating",
"type": "select",
"previous": "4",
"current": "5",
"changed": true
}
],
"content_hash": "8d2e6b4f1a9c3e7d5b0f2a6c8e4d1b93",
"edit_url": "https://example.com/wp-admin/post.php?post=42&action=edit",
"notes": [
"The post was saved, so the previous version is kept in its revisions."
]
}
}
}
Edge cases / errors
- expected_content_hash no longer matches → mosmcp_acfpro_content_changed; read again with mosmcp/acf-get-block-fields. Another user is editing the post → mosmcp_acfpro_post_locked. A trashed post or auto-draft → mosmcp_acfpro_post_not_writable.
- block_name is not the block at block_index → mosmcp_acfpro_block_mismatch; block_index past the last ACF block → mosmcp_acfpro_block_not_found; a field the block does not have → mosmcp_acfpro_block_field_unknown (the error lists its fields).
- A value ACF rejects (required, a choice not offered, limits) → mosmcp_acfpro_value_invalid, and nothing is written. Without unfiltered_html, HTML in the values is filtered by kses first, as in the editor.
- The post is saved through wp_update_post(), so a revision is kept; send the previous values back to undo. A block with uses_post_meta is written to the post's custom fields instead (every block of that type shows the change); if it still holds values of its own → mosmcp_acfpro_block_pending_save, so save the post once in the block editor.
| << Previous | Next >> |
|---|---|
| List ACF Options Pages | Update ACF Gallery Field |
For more information about the Secure MCP Server for WordPress plugin, explore the following resources:
Product Overview | Pricing | Try for Free | Documentation
If you have any questions regarding plugin configuration, pricing plans or licensing, please contact us or mail us at aisupport@xecurify.com.