Use WP-CLI to Disable a Plugin in 4 Easy Steps

Bulletproof Backups for Your WordPress Website

Fortify your business continuity with foolproof WordPress backups. No data loss, no downtime — just secure, seamless operation.

wp-cli disable plugin feature image

Sometimes, a WordPress plugin can cause trouble on your site. Maybe a new update breaks your layout. Maybe a feature suddenly stops working. Sometimes, you just need to turn off a plugin to fix things fast.

Clicking around in the WordPress dashboard can be slow—or sometimes you can’t even log in. Maybe your site crashed or loads too slowly to manage anything.

That’s where WP-CLI comes in. It’s a simple, command-line tool that helps you control your site with just a few typed commands.

If you ever wished there was a faster, more reliable way to disable a plugin—without waiting for pages to load—this guide is for you.

TL;DR: You can quickly disable WordPress plugins with WP-CLI using the wp plugin deactivate command. This method helps when your dashboard is slow or unreachable. Always backup your site first so you can recover it if something goes wrong.

1. Connect to your site

Before you can use WP-CLI, you need to connect to your WordPress site. The steps are different if your site is on your own computer or a remote host. Follow these instructions based on your setup:

If WordPress is on your local computer

  • Open your terminal if you use Mac or Linux. If you use Windows, open Command Prompt or PowerShell.
  • Go to your WordPress folder by using the cd command. For example: cd /path/to/your/wordpress/. This path is where you installed WordPress on your computer.

If WordPress is on a remote web host

  • Many web hosts, like SiteGround, Cloudways, Bluehost, etc., let you connect to your site through SSH.
  • To do so, first find your SSH login details. These usually include:
  • Your SSH username
  • Your SSH server address (this is a hostname or IP address)
  • Your SSH password or a key file for your account
  • Open your terminal.
  • Connect to your site by typing: ssh username@server_address. Replace username and server_address with your details.
  • If the server asks for your password, enter it. If you use a key file, load it with your SSH client.

2. Navigate to your WordPress directory

After you connect to your site, you need to go to your WordPress root directory. This is where your important WordPress files, like wp-config.php, and folders like wp-content, are stored.

To get to this folder, use the cd command in your terminal. For many sites, the root directory is called public_html or www. For example, you might type cd public_html or cd /home/username/www, depending on your setup.

wp directory public_html

If you do not know the right folder, do not worry. You can check your hosting company’s help articles. You can also ask their support team. They will guide you to the correct directory.

Once you are in the right place, you are ready to run WordPress commands with WP-CLI. This is an important step, so make sure you are in the correct folder before moving on.

Tip: WP-CLI is a strong tool, but it does not forgive mistakes. If you type the wrong command, you could break an important part of your site. Moreover, there is no undo option in the terminal.

Also, deactivating a plugin—whether with WP-CLI or the WordPress dashboard—can sometimes break your site. You might not notice something is wrong until you look at your site and see a problem. This is why careful plugin management matters.

Hence, always take a backup of your site before you continue. We suggest using BlogVault for this. BlogVault offers real-time backups, so you can quickly restore your site if something goes wrong. It also helps you disable plugins safely and test changes on a staging site first. This lets you manage plugins with confidence and keeps your WordPress site secure.

3. List your plugins

Before you can disable a plugin, you need to know its slug. The slug is a short name that WordPress uses to identify each plugin.

You can easily see all the plugins on your site by running a simple command in your terminal. Type the following command and press Enter:

wp plugin list

This command will show you a list of all plugins, along with their slugs.

wp plugin list in wp-cli

Check the list and find the slug of the plugin you want to disable. You will use this slug in the next step. Knowing the correct slug helps you avoid disabling the wrong plugin by mistake.

4. Disable the plugin/s

Once you have found the plugin’s slug, you can move on to disabling it. In your terminal, type the following command and hit Enter:

wp plugin deactivate <plugin-slug>

Replace <plugin-slug> with the exact slug of the plugin you want to turn off.

After you press Enter, you should see a Success message. This means the plugin has been deactivated and is no longer running on your site.

wp plugin deactivate in wp-cli

Always double-check the slug before you deactivate a plugin. This helps you avoid turning off the wrong one by accident.

Tip: If you need to disable all plugins simultaneously, just run this command:

wp plugin deactivate --all

One step to turn off every plugin on your site!

5. Uninstall the plugin/s

It’s easy to forget about a plugin once you have deactivated it. But even when plugins are turned off, they can still be a risk. Hackers can use old, deactivated plugins to break into your site if those plugins are not updated.

If you do not plan to use the plugin soon, it is best to uninstall it completely. This helps keep your site safe and reduces clutter.

To remove a plugin, use this command:

wp plugin delete <plugin-slug>

Remember to replace <plugin-slug> with the correct slug you found earlier.

WP-CLI disable plugin—Troubleshooting common issues

Sometimes, things can go wrong when using WP-CLI. Here are some common problems and how you can fix them. This will help you get back on track quickly.

“WP-CLI: Command Not Found”

  • This means WP-CLI is not installed or your system cannot find it.
  • First, check if WP-CLI is installed by typing wp --info.
  • If you see an error, install WP-CLI or add it to your system PATH (on Windows systems).

“Error: This does not seem to be a WordPress install.”

  • You are not in the correct WordPress directory.
  • Use the cd command to move to the folder where wp-config.php is located, then try again.

Permissions errors (like “Permission denied”)

  • Your user might not have the right permissions to work on certain files or folders.
  • Use ls -l to see the file permissions.
  • Make sure files are owned by the right user. Change ownership or permissions with chown or chmod if needed. Only use sudo if you must, and avoid using root unless it’s required.

“Error: Plugin ‘plugin-slug’ is not installed.”

  • The plugin slug you typed does not match any plugin on your site.
  • Check your list of plugins with wp plugin list.
  • Copy the slug exactly as shown to avoid typos.

Incomplete deactivation due to dependency or fatal errors

  • Sometimes, plugins depend on each other. Turning off one can cause errors.
  • Obtain your debug log and check it at wp-content/debug.log for more details.
  • Deactivate dependent plugins first, or solve code issues. If you can’t fix it, you can ask the plugin developer for help.

Site breaks after plugin deactivation

  • Some plugins are essential for how your site works. Turning them off might break your site layout or features.
  • Reactivate the plugin fast using wp plugin activate plugin-slug.
  • Make a list of what that plugin manages so you can replace it safely later. Try changes on a staging site before working on your live site.

Cannot connect to database when running WP-CLI

  • Your database details may be wrong, or your server might be offline.
  • Open wp-config.php and check the database name, username, password, and host.
  • Make sure the database service (like MySQL) is running.
  • Try logging in with another MySQL tool using your credentials. If you’re still stuck, ask your hosting provider for help.

Final thoughts

Disabling plugins with WP-CLI is fast and direct. It helps you solve problems when you can’t use the WordPress dashboard. WP-CLI is a helpful tool for site owners and developers who want more control.

Before you make any big changes, always take a full backup of your site. This keeps your site and your users’ data safe. A tool like BlogVault makes this easy. It comes with features like real-time, encrypted backups, off-site storage, and one-click restores. Having a backup gives you peace of mind if something goes wrong.

FAQs

How do I disable plugins in WP-CLI?

To disable a plugin in WP-CLI, open your terminal, go to your WordPress directory, and type wp plugin deactivate plugin-slug, replacing plugin-slug with the actual plugin’s name. This command will turn off the plugin quickly, without needing to log into your WordPress dashboard.

What are the benefits of managing plugins through WP-CLI?

Managing plugins with WP-CLI is fast and saves time. You can turn plugins on or off with simple commands, even if you cannot access your WordPress dashboard. It also makes handling many plugins easier and lets you fix problems quickly.

Can WP-CLI disable multiple plugins at once?

Yes, WP-CLI can disable multiple plugins at once. You can use the command wp plugin deactivate --all to turn off all plugins on your site with one step. This is quick and useful if you need to troubleshoot issues fast.

Tags:

You may also like


wordpress plugins feature image
15+ WordPress Plugins Your Site Will Thank You For

If you have spent more than ten minutes looking for WordPress plugins, you have probably seen the same pattern. Long lists. Mixed advice. Too many must-have tools that most sites…

How do you update and backup your website?

Creating Backup and Updating website can be time consuming and error-prone. BlogVault will save you hours everyday while providing you complete peace of mind.

Updating Everything Manually?

But it’s too time consuming, complicated and stops you from achieving your full potential. You don’t want to put your business at risk with inefficient management.

Backup Your WordPress Site

Install the plugin on your website, let it sync and you’re done. Get automated, scheduled backups for your critical site data, and make sure your website never experiences downtime again.