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.
Typical workflow
Section titled “Typical workflow”# 1. Download existing ACF configuration from WordPresslps acf pull
# 2. Edit locally, commit to Gitgit add acf/ && git commit -m "feat: add pricing field group"
# 3. Deploy back to WordPresslps acf pushCommands
Section titled “Commands”Every command below also accepts the common flags: --env, --json, and --yes where it applies.
lps acf pull
Section titled “lps acf pull”Download ACF field groups, post types, taxonomies, and options pages from WordPress and write them as .json files, one per object.
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:
lps acf pull --type field-groups --dry-runlps acf push
Section titled “lps acf push”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.
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:
lps acf push ./acflps acf list
Section titled “lps acf list”Print all ACF objects currently on WordPress, grouped by type.
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)lps acf diff
Section titled “lps acf diff”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).
lps acf diff [path]lps acf diff --env staging --against productionExits 0 in sync, 1 on drift, 2 when the comparison failed.
lps acf rollback
Section titled “lps acf rollback”Restore ACF objects on WordPress to the snapshot saved automatically before an earlier lps acf push. See Rollback and Snapshots.
lps acf rollback # the most recent snapshotlps acf rollback --list # available snapshotslps acf rollback --to <id> # an older oneFile format
Section titled “File format”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.