Skip to content

CLI - Getting Started

The Loopress CLI (lps) is a Node.js command-line tool for version-controlling WordPress data and syncing it between your local machine and any WordPress instance.

Terminal window
npm install -g @loopress/cli

Or with pnpm:

Terminal window
pnpm add -g @loopress/cli

Verify the installation:

Terminal window
lps --version

Before running any command, register your WordPress site:

Terminal window
lps site config

You will be prompted for:

PromptDescription
Site nameA local identifier (e.g. production, staging)
WordPress URLFull URL including scheme (https://example.com)
UsernameYour WordPress administrator username
Application passwordGenerated in Users → Profile → Application Passwords

Loopress stores site configurations in ~/.config/loopress/sites.json and keeps track of the currently active site.

Terminal window
lps site config # Add or update a site
lps site switch # Interactively pick the active site
lps site remove <name> # Remove a saved site

All commands operate against the active site unless overridden via environment variables.

For CI/CD pipelines where interactive prompts are not available, you can bypass the site configuration entirely using environment variables:

Terminal window
export WP_URL=https://example.com
export WP_USERNAME=admin
export WP_APP_PASSWORD="xxxx xxxx xxxx xxxx xxxx xxxx"
lps snippets push

Most commands accept a --dryRun (-d) flag that shows what would happen without making any changes:

Terminal window
lps snippets push --dryRun
lps snippets pull --dryRun
lps acf pull --dryRun