30 days free. No credit card. Full access from the moment you connect your site.

Start free trial

Add Repeater Row

Adding one row to a repeater the naive way means reading the whole field, appending to the array and writing all of it back: three round trips, and a diff that touches every row even though one changed.

custom-fields/add-acf-repeater-row is one call. Append a row, or insert it at a 1-based position, on a repeater or flexible-content field attached to any target.

At a glance

Abilitycustom-fields/add-acf-repeater-row
ToolsetAdvanced Custom Fields — toolset/acf
GroupRepeater & Flexible Content
RequiresAdvanced Custom Fields Pro, plus a repeater field registered on the site
Capabilitymanage_options
SafetyWrites data
RepeatableNot idempotent — each call changes the row set, so re-running is not a no-op
Ships inAcrossAI Abilities Manager 0.0.34 and later

How it works

Append is a single targeted write. ACF’s add_row() writes the new row and updates the count, leaving the existing rows alone.

Insert is different. ACF has no positional-insert API, so asking for a position rewrites the array server-side to make room. It is still one call from where you sit, but it touches more rows than an append does — so append unless the order genuinely matters.

The response returns the index the row landed at and the new row count, which is what you need to address it later with custom-fields/update-acf-repeater-row.

Input

NameTypeRequiredWhat it is
target_typestringNo — defaults to postWhat the value is attached to: post, user, term, comment or option. post covers pages and any custom post type.
target_idinteger | stringYes, for post, user, term and commentThe ID of the target. Optional for option, where it names a specific options page; omit it for the default options store.
selectorstringYesRepeater or flexible-content field name (e.g. cards) or field key.
rowobjectYesSub-field name => value for the new row.
positionintegerNo1-based position to insert at. Omit to append.
apply_wp_slashbooleanNo — defaults to trueRuns wp_slash() over your strings before writing, so literal backslashes survive. Set it false only when you have already slashed the payload yourself.

What comes back

NameTypeWhat it is
indexintegerWhere the row landed, 1-based.
row_countintegerHow many rows the field holds now.
successbooleanWhether the call completed.
messagestringA one-line summary of what happened, suitable for showing a human.
error_codestringPresent only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation.

Example

Ask your assistant:

Add a fourth card to the features repeater on page 87 — title “Audit trail”, body “Every call is logged.”

It resolves to one call:

{
  "ability": "custom-fields/add-acf-repeater-row",
  "parameters": {
    "target_type": "post",
    "target_id": 87,
    "selector": "features",
    "row": {
      "title": "Audit trail",
      "body": "Every call is logged."
    }
  }
}

Worth knowing

  • Not idempotent. Retry a call you are unsure about and you get two rows — read the field first if a previous attempt may have landed.
  • The ACF Pro check is on the repeater field type, not on a function name. add_row() ships in the free edition too, where no repeater field can exist for it to act on, so a function check would pass and the write would fail later.
  • Flexible-content fields take layouts, not plain rows. Use custom-fields/add-acf-flex-layout when the field defines layouts.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading