How to Deactivate or Disable a WordPress Plugin on Linux or AWS Lightsail
Sometimes, a WordPress plugin can cause your site to break or perform poorly. Maybe you just installed a new plugin, and now your site is down, or an existing plugin update has caused issues. In these scenarios, quickly disabling the problematic plugin can help you restore your site’s functionality. Here are some methods to do that on a Linux server or AWS Lightsail.
Method 1: Deactivating via WP-CLI
WP-CLI is a handy command-line tool for managing WordPress. If you have it installed, deactivating a plugin is super straightforward.
1. Connect to your server:
-
- Option 1: SSH into your server:
ssh your-username@your-server-ip
- Option 2: Connect using SSH from Lightsail:
- Log in to your AWS Lightsail account.
- Navigate to your instance and click on Connect using SSH.
2. Go to your WordPress directory:
cd /path/to/your/wordpress/directory
3. List your active plugins:
wp plugin list
4. Deactivate the troublesome plugin:
wp plugin deactivate plugin-slug
Replace plugin-slug
with the actual slug of the plugin you need to deactivate.
Method 2: Deactivating via File Renaming
No WP-CLI? No problem. You can disable a plugin by renaming its folder.
1. Connect to your server:
-
- Option 1: SSH into your server:
ssh your-username@your-server-ip
- Option 2: Connect using SSH from Lightsail:
- Log in to your AWS Lightsail account.
- Navigate to your instance and click on Connect using SSH.
2. Navigate to the plugins directory:
cd /path/to/your/wordpress/wp-content/plugins
3. Find the plugin folder and rename it. For example:
mv example-plugin example-plugin-deactivated
By renaming the plugin’s folder, WordPress will automatically deactivate it.
Method 3: Deactivating via the Database
If you’re comfortable working directly with the database, this method works too.
1. Connect to your server and access MySQL:
-
- Option 1: SSH into your server:
ssh your-username@your-server-ip
- Option 2: Connect using SSH from Lightsail:
- Log in to your AWS Lightsail account.
- Navigate to your instance and click on Connect using SSH.
Then, access MySQL:
mysql -u your-db-username -p your-db-name
2. Locate the active_plugins
option:
SELECT option_value FROM wp_options WHERE option_name = 'active_plugins';
3. Update the active_plugins
option:
UPDATE wp_options SET option_value = '' WHERE option_name = 'active_plugins';
This deactivates all plugins. If you only want to deactivate a specific plugin, you’ll need to modify the serialized option_value
carefully.
Method 4: Using the WordPress Admin Dashboard
If your dashboard is still accessible, this is the easiest way.
1. Log into your WordPress admin.
2. Go to the “Plugins” page.
3. Find and deactivate the plugin by clicking the “Deactivate” link under its name.
These methods can come in handy when a plugin update goes wrong, or you need to troubleshoot your site. WP-CLI and renaming the plugin folder are quick and reliable, especially if you lose access to the WordPress admin area.
It worked 2024