Pages
The page command group lets you version-control WordPress pages in Git, as an editable .html content file plus a .json sidecar for metadata.
Unlike acf, seo, form and snippet, this talks directly to WordPress core’s own REST API (wp/v2/pages), so it works on any WordPress site, no Loopress plugin required.
Typical workflow
Section titled “Typical workflow”# 1. Download existing pages from WordPresslps page pull
# 2. Edit locally, commit to Gitgit add pages/ && git commit -m "feat: update about page"
# 3. Deploy back to WordPresslps page pushCommands
Section titled “Commands”lps page pull
Section titled “lps page pull”Download all pages from WordPress and write them as an .html/.json file pair per page.
lps page pull [path]| Argument | Default | Description |
|---|---|---|
path |
./pages (or loopress.json’s pageDir) |
Local directory where pages are written |
| Flag | Description |
|---|---|
--dry-run / -d |
Show what would be written without touching the filesystem |
Local files with an id no longer present on WordPress are removed on pull, so the directory always mirrors the site. In a terminal the files are listed and a confirmation is asked first (--yes skips it); in scripts and CI they are removed and reported. Pages with no id are skipped with a warning.
Example:
lps page pull --dry-runlps page push
Section titled “lps page push”Upload .html/.json file pairs from a local directory to WordPress. Each page is matched by its id; if a local id doesn’t exist on the target site (e.g. a fresh install), a new page is created instead and both local files are renamed to match the assigned id.
lps page push [path]| Argument | Default | Description |
|---|---|---|
path |
./pages (or loopress.json’s pageDir) |
Local directory to read .json files from |
| Flag | Description |
|---|---|
--dry-run / -d |
Show what would be pushed without making any changes |
Example:
lps page push ./pageslps page list
Section titled “lps page list”Print all pages currently on WordPress.
lps page list| Flag | Description |
|---|---|
--json / -j |
Output raw JSON instead of formatted text |
Example output:
Pages (2): 2. Sample Page 9. AboutFile format
Section titled “File format”Each page is stored as a pair of files, named {id}-{slug}.html and {id}-{slug}.json, where {slug} is the page title lowercased and slugified:
pages/ 2-sample-page.html 2-sample-page.json 9-about.html 9-about.jsonThe .html file is the page’s raw content exactly as WordPress stores it, Gutenberg block comments included (<!-- wp:paragraph -->...), a real file you can open and edit directly. The .json sidecar is everything else, round-tripping WordPress’s own REST representation untouched: title and excerpt as {raw, rendered}, plus slug, status, parent, menu_order, template, meta, and so on. Content is kept out of the JSON on purpose, escaped HTML inside a JSON string isn’t something you can reasonably hand-edit.