wp_set_acf
Sets ACF field values for a WordPress post or page, using ACF's update_field to correctly link field keys. Offers dry-run to preview changes before applying.
Instructions
Set a page/post's ACF field VALUES (not the field-group schema).
fields is an object of {field_name: value}; values are arbitrary JSON (string,
number, bool, or a list for a repeater/gallery) and are written through ACF's own
update_field so the field-key linkage is correct. Leading-underscore selectors are
rejected by the site and reported under skipped (the rest still apply, and the
result comes back as 'partial' rather than 'applied'). DEFAULTS TO dry_run=true
(returns a preview; writes nothing). Pass dry_run=false to apply - the write is
verified by reading each value back (ACF's storage normalization, e.g. a true/false
stored as 1, is tolerated). Only fields on an ACF field group already registered for
the post take effect. Requires the REST transport and ACF active. Prod writes require
allow_prod=true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fields | Yes | ||
| dry_run | No | ||
| install | Yes | ||
| post_id | Yes | ||
| allow_prod | No |