WP-CLI is a powerful command tool that can help streamline your workflow by enabling you to manage plugins and themes from the command line. Typically it’s used by more advanced users or those responsible for working on a large number of sites, for example, a developer at an agency or freelancer.
You can use WP-CLI along with Perfmatters to perform basic everyday tasks, and we’ll keep expanding support over time. Below are the current commands we support.
Activate plugin
To activate the Perfmatters plugin, use the following command.
wp plugin activate perfmattersDeactivate plugin
To deactivate the Perfmatters plugin, use the following command.
wp plugin deactivate perfmattersActivate license
To activate the license key in Perfmatters, use the following command. This assumes you’ve already entered the license key into the activation field under the license tab.
wp perfmatters activate-licenseYou can also include the license key in WP-CLI by adding the <key> on the end.
wp perfmatters activate-license [<key>]An unlimited license is required to activate sites in a multisite environment. If you need to run commands on a subsite, you can specify the global URL parameter.
wp perfmatters activate-license [<key>] --url=<url>Deactivate license
To deactivate the license key in Perfmatters, use the following command.
wp perfmatters deactivate-licenseTo deactivate the license on a subsite in a multisite environment, you can specify the global URL parameter.
wp perfmatters deactivate-license --url=<url>Remove license
To remove the license key in Perfmatters, use the following command.
wp perfmatters remove-licenseTo remove the license on a subsite in a multisite environment, you can specify the global URL parameter.
wp perfmatters remove-license --url=<url>Enable plugin options
To enable a plugin option, use one of the supported plugin options. Example below.
wp perfmatters enable delay-jsDisable plugin options
To disable a plugin option, use one of the supported plugin options. Example below.
wp perfmatters disable delay-jsGet options
Use the following command to return a list of available plugin options that can be turned on and off via CLI.
 wp perfmatters get-optionsHere is a list of supported plugin options.
delay-js
defer-js
minify-js
remove-unused-css
minify-css
lazyload-images
lazyload-iframes
css-background-images
lazyload-elements
local-google-fonts
cdn-rewrite
script-manager
clean-uninstall 
Clear used CSS
You can clear the used CSS in Perfmatters using the following command.
wp perfmatters clear-used-cssTo clear the used CSS on a subsite in a multisite environment, you can specify the global URL parameter.
wp perfmatters clear-used-css --url=<url>To clear the used CSS across an entire multisite network (all subsites), you can use the global network parameter.
wp perfmatters clear-used-css --networkClear minified JS
You can clear the minified JS in Perfmatters using the following command.
wp perfmatters clear-minified-jsTo clear the minified JS on a subsite in a multisite environment, you can specify the global URL parameter.
wp perfmatters clear-minified-js --url=<url>To clear the minified JS across an entire multisite network (all subsites), you can use the global network parameter.
wp perfmatters clear-minified-js --networkClear minified CSS
You can clear the minified CSS in Perfmatters using the following command.
wp perfmatters clear-minified-cssTo clear the minified CSS on a subsite in a multisite environment, you can specify the global URL parameter.
wp perfmatters clear-minified-css --url=<url>To clear the minified CSS across an entire multisite network (all subsites), you can use the global network parameter.
wp perfmatters clear-minified-css --networkClear local Google Fonts
You can clear the local Google Fonts in Perfmatters using the following command.
wp perfmatters clear-local-fontsTo clear the local Google Fonts on a subsite in a multisite environment, you can specify the global URL parameter.
wp perfmatters clear-local-fonts --url=<url>To clear the local Google Fonts across an entire multisite network (all subsites), you can use the global network parameter.
wp perfmatters clear-local-fonts --networkImport settings
To import settings configuration from an exported .json file, use the following command.
wp perfmatters import-settings <filepath>