Fill an ACF block on a page

ContentIntermediate~15 min

Before you start

Advanced Custom Fields active, plugin version 1.10.0 or newer, and the ACF block already placed on the page, empty or with old values. Get block type and Replace block are off until you switch them on in the Abilities tab, and Replace block is a write, so enable it only for the write pass. The agent needs edit access to the page.

The block is on the page already. A developer placed it, the layout looks right, and all it needs is the content: a name, a role, a photo, a short bio. Filling it by hand means opening the editor and clicking through every field. Having an agent rewrite the whole page to do it means trusting it with every other block too.

This recipe does neither. It reads what the block expects, finds that one block on the page, and swaps in a filled copy. Nothing else on the page is resent.

The prompt
Our [About] page (id [42]) has an empty [team member] ACF block on it, and
I want it filled in with these values:
[name: Sara Khan, role: Head of Support, photo: the image titled
"sara-headshot", bio: two sentences below].
Read first. Open the [team member] block type and list its field names,
types and choices. Then read the page as raw block markup and tell me the
position of that block, counting only real blocks.
For the photo, look up the attachment ID in the Media Library. Check every
value against the field it goes in, and tell me if anything does not fit.
Show me the exact new block markup next to the current one. Do not save
until I say go. When I do, replace only that block, checking that the
block at that position is still the [team member] block, and keep the old
markup in your reply. Report any content warnings the write returns.

Why this is safe to run

Everything before the write is a read: the block’s field list, the page’s raw markup, and the media lookup. You see the exact markup that would replace the block before it is saved, and the agent checks your values against the real field names and choices first.

The write is a single Replace block call against one block. The prompt asks the agent to pass the block name it expects at that position, so if the page changed in the meantime the call refuses instead of overwriting a different block. Replace block is off until you enable it, it is checked against the edit access of the user you bound the agent to, and it lands in the Activity Log. When revisions are on, the page’s history can restore it.

If you have not looked at the block yet, start with read an ACF block’s fields before you fill it.

Already connected? You do not have to paste this. Ask your agent for the “fill an ACF block on a page” recipe, or tell it which block to fill and with what, and it runs the same read-first flow on your own site.

How it works

  1. Read the ACF block's field names, types and example payload.
  2. Read the page as raw block markup and find the ACF block by its position.
  3. Look up attachment IDs for any image fields, and check each value against the field's choices.
  4. Show the exact new block markup next to the current one and wait for your approval.
  5. Replace that one block, and report any content warnings the write returns.

Questions

Does this rewrite the whole page?
No. Replace block swaps one block, found by its position on the page, and the plugin leaves the other blocks' attributes and HTML as they were. For a user who cannot post unfiltered HTML, WordPress may still sanitize the whole page when it saves.
Can I undo it?
When WordPress revisions are on, the change can be restored from the page's revision history. The prompt also keeps the old block markup in the reply, so you can see exactly what was there.
What if a value does not match a field?
The read pass shows the real field names and choices first, so mismatches surface in the preview. If one still slips through, the write returns an unknown_acf_field warning naming the keys ACF ignored.