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.


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>


wp litespeed-option set cache-priv false


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

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>'


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

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>


wp litespeed-option get cache-priv


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>]`


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>


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>


wp litespeed-option import_remote

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>


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>


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>


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>


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>


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>


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 server.

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

Pull Images

Pulls optimized images from the 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 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 Commands Online Services commands begin with litespeed-online.

Generate API Key

Generates an anonymous domain API key for secure communication with

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

Sync Data

Synchronizes service usage information..

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

List Cloud Services

Lists all services.

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

List Nodes in Use

Lists all currently active nodes.

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

Detect Closest Node

The closest active node for a particluar service.

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


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

Last update: December 14, 2022