Knowledge Base

How to use WP-CLI

Last modified: October 17, 2022

WP-CLI comes preinstalled on Pressable and extends the shell to provide WordPress-specific command line tools. You can start running WP-CLI commands once you have connected to SSH.

There are many commands and subcommands that can help with managing and troubleshooting your site. For more on the commands available and how to use them, you can visit the WordPress.org documentation for WP-CLI

Manage Themes and Plugins with WP-CLI

WP-CLI can be used to manage and troubleshoot plugins and themes.

WP-CLI Command

wp plugin list

Description

List installed plugins including their status and version.

WP-CLI Command

wp theme list

Description

List installed themes.

WP-CLI Command

wp plugin deactivate plugin-name

Description

Deactivates a plugin. Replace plugin-name with a name value found via wp plugin list. Multiple plugin names can be entered in order to deactivate more than one.

WP-CLI Command

wp plugin activate plugin-name

Description

Activates a plugin. Replace plugin-name with a name value found via wp plugin list. Multiple plugin names can be entered in order to activate more than one.

WP-CLI Command

wp theme activate theme-name

Description

Activate a theme. Replace theme-name with a name value found via wp theme list.

WP-CLI Command

wp php-errors

Description

List recent PHP errors logged. This is useful for identifying problematic plugins and themes that may need to be updated or deactivated.

Skip Themes and Plugins with WP-CLI

If your site is encountering errors and cannot run commands, it may be necessary to skip the site’s active theme and plugin code. This is done by adding --skip-themes and --skip-plugins to any WP-CLI command.

WP-CLI Command

wp --skip-plugins --skip-themes plugin deactivate plugin-name

Description

Skip theme and plugin code then deactivate a plugin. Replace plugin-name with a name value found via wp plugin list.

WP-CLI Command

wp --skip-plugins --skip-themes theme activate theme-name

Description

Skip theme and plugin code then activate a theme. Replace theme-name with a name value found via wp theme list.

WP-CLI Command

wp --skip-plugins --skip-themes php-errors

Description

Skip theme and plugin code then list recent PHP errors logged. This is useful for identifying problematic plugins and themes that may need to be updated or deactivated.

Frequently Asked Questions

Can I get support for using command line tools?

Due to the complex nature of SSH and WP-CLI, we are not able to provide extensive support for using these tools. Our Support Team is available to help with issues connecting via SSH but cannot guide you through using commands.

Are all commands available?

In order to provide a secure and performant environment, Pressable may restrict or disable certain shell and WP-CLI commands.

What if something goes wrong?

If something happens to your site after you’ve made changes via SSH, or if you run a command and something happens you didn’t expect, you can restore your site from a backup.

We will NOT be able to help you debug your command to make it work as expected.