Skip to content

ACF

The acf command group lets you version-control Advanced Custom Fields configuration as plain JSON files in Git: field groups, post types, taxonomies, and options pages.

Requires ACF to be installed and active on the WordPress site, either ACF PRO or the free Secure Custom Fields fork. Every lps acf command also answers to lps scf (lps scf pull, lps scf push, …), use whichever matches your plugin. Options pages must be registered with acf_add_options_page() for pull/push to see them.

Terminal window
# 1. Download existing ACF configuration from WordPress
lps acf pull
# 2. Edit locally, commit to Git
git add acf/ && git commit -m "feat: add pricing field group"
# 3. Deploy back to WordPress
lps acf push

Every command below also accepts the common flags: --env, --json, and --yes where it applies.

Download ACF field groups, post types, taxonomies, and options pages from WordPress and write them as .json files, one per object.

Terminal window
lps acf pull [path]
Argument Default Description
path ./acf (or loopress.json’s acfDir) Local directory where ACF configuration is written
Flag Description
--type Limit to specific object types: field-groups, post-types, taxonomies, options-pages. Repeatable.
--dry-run / -d Show what would be written without touching the filesystem

Local files with a key no longer present on WordPress are removed on pull, so the directory always mirrors the site. See pull mirrors the site for the confirmation asked first.

Example:

Terminal window
lps acf pull --type field-groups --dry-run

Upload .json files from a local directory to WordPress. Each object is identified by its own stable key, so push always resolves to create-or-update on that object, there’s no id/slug matching step like snippets.

Active content is stripped from every string in the imported object (field labels, instructions, choices, a Message field’s content) before it is stored: those are rendered in the block editor for every user who opens a post using the group, so a <script> or onerror= handler pushed there would otherwise run in an admin session. Benign HTML and plain text are left byte-for-byte unchanged.

Terminal window
lps acf push [path]
Argument Default Description
path ./acf (or loopress.json’s acfDir) Local directory to read .json files from
Flag Description
--type Limit to specific object types: field-groups, post-types, taxonomies, options-pages. Repeatable.
--dry-run / -d Show what would be pushed without making any changes

Example:

Terminal window
lps acf push ./acf

Print all ACF objects currently on WordPress, grouped by type.

Terminal window
lps acf list
Flag Description
--type Limit to specific object types: field-groups, post-types, taxonomies, options-pages. Repeatable.
--json Output raw JSON instead of formatted text

Example output:

field-groups (2):
group_pricing. Pricing Fields
group_homepage. Homepage Fields
options-pages (0):
(none)

Show what differs between your local ACF objects and a WordPress environment, or between two environments with --against. Also part of the aggregate lps diff (--only acf).

Terminal window
lps acf diff [path]
lps acf diff --env staging --against production

Exits 0 in sync, 1 on drift, 2 when the comparison failed.


Restore ACF objects on WordPress to the snapshot saved automatically before an earlier lps acf push. See Rollback and Snapshots.

Terminal window
lps acf rollback # the most recent snapshot
lps acf rollback --list # available snapshots
lps acf rollback --to <id> # an older one

Each ACF object is stored as one file, named {key}.json, in a subdirectory per type:

acf/
field-groups/
group_pricing.json
group_homepage.json
post-types/
post_type_testimonial.json
taxonomies/
options-pages/

Files round-trip ACF’s own export format untouched, the CLI only reads the key field to name the file and identify the object on push.