Skip to content
Sign in Get started
Menu
Developer docs menu

WP-CLI

Applies to Companion 1.0.3 Updated 14 November 2026 View as Markdown

LanternWP Companion adds two WP-CLI commands for demos, part of the public API, whose options are in the WP-CLI reference, and wp lanternwp account for a site connected to a lanternwp.com account.

wp lanternwp demo import

Imports a demo into this store, or brings an earlier import of it up to date. Everything the import creates carries the demo's own ids, so a rerun updates what is there instead of duplicating it and deletes what the demo no longer has. The LanternWP theme (or a child theme of it) and WooCommerce must be active.

The demo comes from the demo store of lanternwp.com, without the Demos screen's Show the demos from lanternwp.com: running the command is the request, and it does not allow the demos on that screen. The files of the version, the latest unless one is named, are downloaded into the uploads folder, each checked against its checksum, and removed after the import; images the store already has from an earlier import are not downloaded again. An interrupted download keeps its files, and running the command again continues it.

wp lanternwp demo import <demo> [--dir=<directory>] [--server=<url>]
Option What it does
<demo> The demo's id, such as base, or the id and a version, such as base@2
--dir=<directory> Import from this directory instead: the demo's built manifest.json beside its images. A directory holds one version, so name the demo without a version
--server=<url> The demo store to download from; https://lanternwp.com by default

The demos' ids are base (Common Goods), voltline, kilowatt, halden and tessel.

wp lanternwp demo import base
wp lanternwp demo import voltline@2
wp lanternwp demo import base --dir=./base

The store's own settings stay as they are: its name, tagline, currency and price format, country and address, store phone, units, time zone and date format, the sender of store emails, taxes, checkout account options, payment methods and shipping. The demo's logo and site icon go into the media library and are set only where the store has none of its own (none, or an image since deleted; one an earlier demo import set counts as none), each on its own; its products' weights and dimensions are converted into the store's units. The report ends with a To set up: line for each thing the store lacks for the demo to work as shown (no payment method turned on, no shipping method for the store's country, a feature that needs setup), with the address of the screen where it is set.

--keep-settings is deprecated: the command still accepts it, with or without a list of groups, prints a warning and ignores it, since the import keeps every store setting. Remove it from your scripts; a later version may remove it.

On a client's site this is the quickest way to deliver a store: install the theme, WooCommerce and Companion, run the command, then set up what it lists.

wp lanternwp demo look

Gives the store a demo's look and changes nothing else: the demo's colors, fonts, shape, spacing and product card. The look goes into the user's styles, as Browse styles in the Site Editor's Styles puts a style variation there: the theme's variation of the demo (styles/<demo>.json), or, when the theme has none (a demo newer than the theme), the look in the demo's manifest.json in the same shape, each preset list under the theme's origin. Either way the demo's name is in settings.custom.look, and Reset styles comes back to the theme's own look. Products, pages, menus, templates and settings stay. Only the version's manifest.json is read, and nothing is saved in the uploads folder. Base's look is the theme's own, so base puts it back.

wp lanternwp demo look <demo> [--dir=<directory>] [--server=<url>] [--keep-styles]

The changes in Styles and the LanternWP panel are replaced, except the store's own CSS, and Styles' revisions keep them; Appearance → LanternWP → Demos does the same with Use the look only. --keep-styles leaves Styles as they are and says where the demo's look is: in Browse styles, or nowhere yet when the theme has no variation of it. wp lanternwp demo import puts the demo's look into Styles the same way, and its --keep-styles leaves them as they are too.

wp lanternwp demo look kilowatt
wp lanternwp demo look base

The look is in the user's styles of the active theme, so it stays when Companion is deactivated. A child theme activated later has styles of its own and starts from its own look: choose the demo in Browse styles there, or run the command again.

wp lanternwp account

Connects the site to a lanternwp.com account, whose private demos wp lanternwp demo import and wp lanternwp demo look then read. The connection is the site's alone (each site of a network connects on its own) and is the same one Appearance → LanternWP → Demos makes with Connect to lanternwp.com. Like wp lanternwp demo, the commands need no Show the demos from lanternwp.com on that screen and do not give it: until an administrator selects it there, the screen sends nothing for the connection (not the token either) and shows only the account and the connection's label from what the site keeps, and connect says so. These commands are not part of the public API yet.

wp lanternwp account connect [--server=<url>] < token.txt
wp lanternwp account status
wp lanternwp account disconnect
  • connect reads a connection token made in the lanternwp.com account from standard input, never from an argument: redirect a file or pipe it from a password manager. What is not a token (lwp_ and up to 500 more characters) is sent nowhere. It asks lanternwp.com which account and connection the token belongs to, stores the connection in place of any other, and prints the connection's label and the token's last four characters. --server names the lanternwp.com that issued the token, https://lanternwp.com by default; it has to be https://, or http:// on this computer.
  • status prints the server, the account, the connection's label, when it was connected, and whether lanternwp.com still accepts it or the site's address changed since. It exits with 1 unless the site is connected and the connection can be used.
  • disconnect cancels an unfinished import of a private demo, deletes the downloads of private demos, asks lanternwp.com once to end the connection, without waiting when it asks the site to wait, and deletes it from the site whatever lanternwp.com answers. What was imported stays. When the downloads cannot be deleted, it prints a warning naming the folder to delete; when lanternwp.com could not be told (no answer, an answer that is not the connection's end, or the site's address changed since it connected), a warning says to end the connection in the account's settings on lanternwp.com. It waits up to 15 seconds for a step of an import that runs on the Demos screen.

When lanternwp.com asks the site to wait (429) on an account route, connect and the downloads of a private demo ask up to three times, waiting between as long as its Retry-After says when that is two minutes or less, and read the connection again before they ask again; the public routes are asked once, as without a connection. wp lanternwp demo import and wp lanternwp demo look ask the public routes first. Only when those say there is no such demo (not a version of a demo they have), and the site is connected to an account of the server --server names, do they ask the account's list with the token, once and without waiting, and a demo on it comes from the account; when the account cannot say now, the command answers with the public routes' error and why, and while an import step on the Demos screen holds the import's lock for longer than ten seconds, it says that an import is already running. Without a connection the error is the public routes' own; with a connection to another server the command says which one to name, and the token is not sent. Each file of a private demo waits up to a minute for a step of an import that runs on the Demos screen:

wp lanternwp demo import <private demo> --server=https://lanternwp.com