Disabling a Plugin with WP-CLI | BoldGrid

Disabling a Plugin with WP-CLI

If you are troubleshooting a WordPress Fatal Error and you need to disable a Plugin without access to your WordPress dashboard, you can use these instructions to disable it using the WordPress Command Line Interface, or WP-CLI.

  1. SSH into your WordPress hosting environment, using your Web Host’s instructions for doing so.
  2. Change directories to the root directory containing your WordPress installation. In these examples, the directory ~/public_html is used in place of the root directory for WordPress.
    user@wordpress [~]$ cd ~/public_html/
  3. Get a list of your plugins with the command wp plugin list:
    user@wordpress [~/public_html]$ wp plugin list
    +-------------------------------+----------+--------+----------+
    | name                          | status   | update | version  |
    +-------------------------------+----------+--------+----------+
    | akismet                       | active   | none   | 4.1.2    |
    | boldgrid-backup               | active   | none   | 1.9.3    |
    | boldgrid-backup-premium       | active   | none   | 1.1.2    |
    | hello                         | inactive | none   | 1.7.2    |
    | jetpack                       | inactive | none   | 7.4      |
    +-------------------------------+----------+--------+----------+

    In this example, the plugins Akismet, BoldGrid Backup, and BoldGrid Backup Premium are currently active, and the list of names, or slugs, shows the other inactive plugins you have installed..

  4. Deactivate a plugin using the command wp plugin deactivate plugin-slug where “plugin-slug” is replaced with the name of the plugin you saw from the previous command:
    user@wordpress [~/public_html]$ wp plugin deactivate akismet
    Plugin 'akismet' deactivated.
    Success: Deactivated 1 of 1 plugins.
  5. If you receive an error, you may need to add one of the following modifiers to your command: —skip-themes or –skip-plugins
    user@wordpress [~/public_html]$ wp plugin deactivate akismet --skip-themes --skip-plugins
    Plugin 'akismet' deactivated.
    Success: Deactivated 1 of 1 plugins.

Congratulations! You now know how to deactivate a plugin using WP-CLI.

 

Get more for free by signing up with BoldGrid Central Create Account