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.

Option Commands

Set an option

For example, set to not cache the login page:

wp lscache-admin set_option cache_login false

Get all options

wp lscache-admin get_options

Export options to a file

wp lscache-admin export_options

Import options from ''CURRENTDIR/options.txt''

wp lscache-admin import_options options.txt

Purge Commands

List all the site domains and ids in a table

wp lscache-purge network_list

Purge Everything associated with the WordPress install

wp lscache-purge all

Purges all cache entries for the blog

For example, in a multisite install, purge only the shop.example.com cache (stored as blog id 2):

wp lscache-purge blog 2

For example, purge the front page:

wp lscache-purge url https://mysite.com/

Purges cache tags for a WordPress tag

For example, purge the tag ids 1, 3, and 5:

wp lscache-purge tag 1 3 5

Purges cache tags for a WordPress category

For example, purge the category ids 1, 3, and 5:

wp lscache-purge category 1 3 5

Purges cache tags for a WordPress Post/Product

For example, purge the post ids 1, 3, and 5

wp lscache-purge post_id 1 3 5

Image Optimization Commands

Removes original backups

wp lscache-iapi rm_bkup
litespeed_wiki/cache/lscwp/wordpress_cli.txt · Last modified: 2018/09/10 13:04 by Lisa Clarke