Skip to content

Global Styles

The styles command group syncs the Global Styles of a Full-Site Editing (FSE) WordPress theme. It reads and writes the JSON payload that drives theme.json and any extra CSS added via the Site Editor.

WordPress stores Global Styles as a custom post. The CLI fetches that post (including its ID) on pull and writes it back on push. Because the ID is embedded in the saved JSON file, you must always pull before push on a fresh checkout.

Download the current Global Styles from WordPress and save them to a JSON file.

Terminal window
lps styles pull [path]
ArgumentDefaultDescription
path./styles.jsonOutput file (includes the style ID required for push)

Example:

Terminal window
lps styles pull
lps styles pull ./theme/styles.json

Upload Global Styles back to WordPress. The command also bundles any *.css files found in ./styles/**/*.css and injects them as the custom CSS property.

Terminal window
lps styles push [path]
ArgumentDefaultDescription
path./styles.jsonJSON file previously created by pull
FlagDescription
--dryRun / -dShow the payload that would be sent without making changes

Example:

Terminal window
# Edit styles.json, then:
lps styles push
# With extra CSS files:
# ./styles/typography.css and ./styles/components.css are bundled automatically
styles.json ← pulled from WordPress (commit this)
styles/
typography.css
components.css
overrides.css

The JSON file is committed to Git. CSS files are bundled on the fly during push so you can split your custom CSS across multiple files without touching styles.json manually.

  • The path argument must point to a JSON file that contains an id field. If the file is missing an id, the push will fail with an error.
  • Global Styles are theme-specific. Switching themes resets them; always re-pull after a theme change.