WpW: Using LSCache with the WordPress CLI
Welcome to another installment of WordPress Wednesday!
Today’s topic is: Using LSCache with the WordPress CLI
WP-CLI is the command-line interface for WordPress. It allows you to perform many actions that would normally require you to visit the WordPress Dashboard in a browser. LiteSpeed’s WP-CLI commands that allow you to manage your cache simply from the command line, and with version 3.0 of our plugin, we have expanded these options considerably.
This is just a taste of the commands available. For the full list, including CLI commands for QUIC.cloud services and debugging purposes, please see our documentation.
litespeed-option plus these commands to view and change LSCache’s configuration.
allallows you to see what options are available:
wp litespeed-option all
exportsends all of the options to a file:
wp litespeed-option export
setallows you to change a particular option to a particular value. (It might be handy to export the options first, so that you know what each option is named, and what type of value is expected.):
wp litespeed-option set cache-priv false
importconfigures LSCache according to the options in a specified file:
wp litespeed-option import options.txt
litespeed-purge plus these commands to purge specific entries from the cache.
network_listdisplays all of the site domains and IDs in a table:
wp litespeed-purge network_list
allpurges all cache entries associated with the WordPress installation. For networks, purges all cache entries for every site in the network:
wp litespeed-purge all
blogpurges all cache entries for a particular blog ID. For example, in a multisite install, purge only the
shop.example.comcache (stored as blog id
wp litespeed-purge blog 2
tagpurges the listed WordPress tags by ID. For example, purge the tag IDs
wp litespeed-purge tag 1 3 5
categorypurges the listed WordPress categories by ID. For example, purge the category ids
wp litespeed-purge category 1 3 5
post_idpurges all cache tags related to the listed WordPress Posts or Products by ID. For example, purge the post ids
wp litespeed-purge post_id 1 3 5
Have some of your own ideas for future WordPress Wednesday topics? Leave us a comment!
Don’t forget to meet us back here next week for the next installment. In the meantime, here are a few other things you can do:
- Subscribe to the WordPress Wednesday RSS feed
- Download LiteSpeed Cache for WordPress plugin
- Learn more about the plugin on our website