Skip to content

WordPress CLI

WP-CLI is the command-line interface for WordPress. It allows you to perform many actions that would normally require visiting your WordPress Dashboard in a browser. The following commands are provided by LiteSpeed, so that you may manage your cache with the CLI.

Warning

These commands are new for v3. All previous commands have been deprecated. Please update your scripts accordingly.

Option Commands

Commands having to do with options all begin with litespeed-option.

Set a Particular Option

  • Command: litespeed-option set
  • Parameters:
  • <key>: the option key to update
  • value>: the value to assign to the option
wp litespeed-option set <key> <value>

Example

wp litespeed-option set cache-priv false

Example

wp litespeed-option set 'cdn-mapping[url][0]' https://cdn.EXAMPLE.com

What if <value> contains multiple lines? The CLI doesn't accept multi-line input, so you would need to use a different syntax, like this:

wp litespeed-option set <key> $'<value1>\n<value2>'

Example

To set media-lqip_exc to a list of three images like this:

img1.jpg
img2.jpg
img3.jpg
Use the following command:
wp litespeed-option set media-lqip_exc $'img1.jpg\nimg2.jpg\nimg3.jpg'`

Get a Particular Option

  • Command: litespeed-option get
  • Parameters:
  • <key>: the option key to return the value of
wp litespeed-option get <key>

Example

wp litespeed-option get cache-priv

Example

wp litespeed-option get 'cdn-mapping[url][0]'

Get All Options

Displays a list of all options and their values.

  • Command: litespeed-option all
  • Parameters: none
wp litespeed-option all

Export Options

All options are exported to CURRENTDIR/lscache_wp_options_DATE-TIME.txt unless a new path is specified.

  • Command: litespeed-option export
  • Parameters:
  • [--filename=<path>]: optional different path to save export file
wp litespeed-option export `[--filename=<path>]`

Example

wp litespeed-option export --filename=/tmp/export

Import Options

Import options from specified file. Options must be one per line and formatted as option_key=option_value. A semicolon (;) at the beginning of a line indicates a comment. Comment lines are ignored.

  • Command: litespeed-option import
  • Parameters:
  • <file>: options file to import
wp litespeed-option import <file>

Example

wp litespeed-option import options.txt

Import Remote Options

Import options from a remote URL. Options must be one per line and formatted as option_key=option_value. A semicolon (;) at the beginning of a line indicates a comment. Comment lines are ignored.

  • Command: litespeed-option import_remote
  • Parameters:
  • <URL>: URL of options file to import
wp litespeed-option import_remote <URL>

Example

wp litespeed-option import_remote https://example.com/options.txt

Reset Options

Resets all options to factory default.

  • Command: litespeed-option reset
  • Parameters: none
wp litespeed-option reset

Purge Commands

LiteSpeed Cache Purge Interface commands begin with litespeed-purge.

Network List

Lists all site domains and IDs on the network.

  • Command: litespeed-purge network_list
  • Parameters: none
wp litespeed-purge network_list

Purge Network

Purges all cache entries for every site in the network. Also works for non-networked sites, just purges that single site.

  • Command: litespeed-purge all
  • Parameters: none
wp litespeed-purge all

Purge Blog

Purges all cache entries for a particular site in the network.

  • Command: litespeed-purge blog
  • Parameters:
  • <blogid>: ID of the site to purge
wp litespeed-purge blog <blogid>

Example

wp litespeed-purge blog 2

Purge Category

Purges all cache entries for a list of categories.

  • Command: litespeed-purge category
  • Parameters:
  • <ids>: IDs of the categories to purge, separated by a space
wp litespeed-purge category <ids>

Example

wp litespeed-purge category 1 3 5

Purge Tag

Purges all cache entries for a list of tags.

  • Command: litespeed-purge tag
  • Parameters:
  • <ids>: IDs of the tags to purge, separated by a space
wp litespeed-purge tag <ids>

Example

wp litespeed-purge tag 1 3 5

Purge Post

Purges all cache entries for a list of post IDs.

  • Command: litespeed-purge post_id
  • Parameters:
  • <ids>: IDs of the posts to purge, separated by a space
wp litespeed-purge post_id <ids>

Example

wp litespeed-purge post_id 1 3 5

Preset Commands

Apply presets and restore backups using litespeed-presets.

Apply a Preset

Applies a particular preset configuration.

  • Command: litespeed-presets apply
  • Parameters:
  • <preset>: Name of the preset you'd like to apply
wp litespeed-presets apply <preset>

Example

wp litespeed-presets apply basic

Get a List of Backups

When you apply a preset, a backup is saved of your existing configuration before the preset is applied. This option provides a list of available backups.

  • Command: `litespeed-presets get_backups
  • Parameters: none
wp litespeed-presets get_backups

Restore a Backup

Restores a previous configuration using one of the backups listed via the get_backups option.

  • Command: litespeed-presets restore
  • Parameters:
  • <backup_number>: Number of the backup that you'd like to restore
wp litespeed-presets restore <backup_number>

Example

wp litespeed-presets restore 1667485245

Image Optimization Commands

LiteSpeed Image Optimization commands begin with litespeed-image.

Push Images

Sends an image optimization request to the QUIC.cloud server.

  • Command: litespeed-image push
  • Parameters: none
wp litespeed-image push

Pull Images

Pulls optimized images from the QUIC.cloud server.

  • Command: litespeed-image pull
  • Parameters: none
wp litespeed-image pull

Get Status

Shows optimization status based on local data.

  • Command: litespeed-image status or litespeed-image s
  • Parameters: none
wp litespeed-image status

Clean Up

Cleans up unfinished image data on the QUIC.cloud server.

  • Command: litespeed-image clean
  • Parameters: none
wp litespeed-image clean

Remove Original Backups

Removes original image backups.

  • Command: litespeed-image rm_bkup
  • Parameters: none
wp litespeed-image rm_bkup

Use Optimized or Original Images

Switch between whether your site is serving optimized images or the original image backups.

  • Command: litespeed-image batch_switch
  • Parameter: optm for optimized images, and orig for original images
wp litespeed-image batch_switch orig

QUIC.cloud Commands

QUIC.cloud Online Services commands begin with litespeed-online.

Generate API Key

Generates an anonymous domain API key for secure communication with QUIC.cloud.

  • Command: litespeed-online init
  • Parameters: none
wp litespeed-online init

Sync Data

Synchronizes QUIC.cloud service usage information..

  • Command: litespeed-online sync
  • Parameters: none
wp litespeed-online sync

List Cloud Services

Lists all QUIC.cloud services.

  • Command: litespeed-online services
  • Parameters: none
wp litespeed-online services

List Nodes in Use

Lists all currently active QUIC.cloud nodes.

  • Command: litespeed-online nodes
  • Parameters: none
wp litespeed-online nodes

Detect Closest Node

The closest active QUIC.cloud node for a particular service.

  • Command: litespeed-online ping
  • Parameters:
  • <service>: Service you wish to find a node for
wp litespeed-online ping <service>

Example

wp litespeed-online ping img_optm

Debug Commands

LiteSpeed Debug commands begin with litespeed-debug.

Send Report

Sends an Environment Report to LiteSpeed

  • Command: litespeed-debug send
  • Parameters: none
wp litespeed-debug send

Crawler Commands

LiteSpeed Crawler commands begin with litespeed-crawler.

List all crawlers

Get a list of all existing crawlers.

  • Command: litespeed-crawler list or litespeed-crawler l
  • Parameters: none
wp litespeed-crawler list

Enable crawler

Enable the specified crawler.

  • Command: litespeed-crawler enable
  • Parameters:
  • <number>: the crawler ID number
wp litespeed-crawler enable <number>

Example

wp litespeed-crawler enable 2

Disable specified crawler

Disable the specified crawler.

  • Command: litespeed-crawler disable
  • Parameters:
  • <number>: the crawler ID number
wp litespeed-crawler disable <number>

Example

wp litespeed-crawler disable 2

Start crawling

Start the crawler running.

  • Command: litespeed-crawler run or litespeed-crawler r
  • Parameters: none
wp litespeed-crawler run

Reset crawler

Reset the crawler's position.

  • Command: litespeed-crawler reset
  • Parameters: none
wp litespeed-crawler reset

Last update: April 23, 2024