When WordPress fails to delete an old plugin during an update or manual removal, you’ll see an error like “Could not remove the old plugin.” This usually happens due to file permission issues, server-side restrictions, or a corrupted plugin folder. This guide walks you through the most effective fixes, from simple retries to manual server-side removal, so you can cleanly delete the plugin and get your site back to normal.
What You’ll Need
- WordPress admin access (at least an Administrator account).
- FTP/SFTP credentials or access to your hosting file manager.
- Access to your hosting control panel (cPanel, Plesk, etc.) for some fixes.
- A code editor or text editor (for editing wp-config.php if needed).
- A backup of your site (always recommended before making server changes).
Step-by-Step
- Retry the deletion in WordPress. Go to Plugins → Installed Plugins. Find the plugin that shows the error, click “Delete” again. Sometimes the error is transient, especially after a failed update. If it deletes, you’re done. If not, proceed.
- Check file permissions. The most common cause is incorrect file ownership or permissions. Using your FTP client or hosting file manager, navigate to
/wp-content/plugins/. Look for the plugin folder (the one that failed to delete). Right-click it and select “File Permissions” (or “Permissions”). Set the folder to755(or775if you’re on a shared host with a different user). Set all files inside to644(or664). Make sure the owner is your hosting user (often the same as the cPanel username). Apply recursively, then try deleting again in WordPress. - Delete via FTP or file manager. If WordPress still won’t delete it, bypass WordPress entirely. Connect via FTP or open the hosting file manager. Navigate to
/wp-content/plugins/. Find the plugin folder (e.g.,my-plugin). Right-click and select “Delete” (or “Move to Trash”). Confirm the deletion. If it deletes, the plugin is gone. If you get an error in FTP, you have a server-side issue (see Troubleshooting). - Disable the plugin via database (if it’s still active). If the plugin folder is gone but WordPress still shows it as active, you need to remove the activation entry from the database. Use phpMyAdmin (from cPanel or your host). Open your WordPress database. Look for the
wp_optionstable (prefix might be different, e.g.,wp_). Search for the option nameactive_plugins. Edit that row. You’ll see a serialized array of plugin paths. Find the one that matches the deleted plugin and remove it. Save. This isn’t always necessary, but it cleans up the error. - Clear any server-side caches. Some hosts use server-side caching (like Varnish or OPcache) that might keep the old files locked. In cPanel, look for “Cache” or “Optimize” tools. Clear all caches. If you use a caching plugin (e.g., W3 Total Cache), purge its cache too. Then try deleting again.
- Use WP-CLI (if you have SSH access). If you’re comfortable with command line, connect via SSH and run:
wp plugin delete my-plugin. This often bypasses permission issues because it runs as the server user. If WP-CLI isn’t installed, you can skip this. - Rename the plugin folder. As a last resort, rename the plugin folder (e.g., from
my-plugintomy-plugin-old) via FTP. This deactivates it. Then try deleting the renamed folder. If that works, the original name is now free for a fresh install if needed.
Common Mistakes
- Not checking file ownership. Even if permissions are 755, if the owner is wrong (e.g., root instead of your user), WordPress can’t delete it. Always check the owner in your FTP client.
- Deleting the wrong folder. Double-check the plugin slug. Deleting a different plugin’s folder can break your site. The error message usually names the plugin, but verify the folder name matches.
- Skipping the cache clear. Server-side caches can lock files, making them appear undeletable. Always clear caches before assuming a permission issue.
- Not deactivating first. Sometimes WordPress won’t delete an active plugin. Deactivate it first (if possible) from the Plugins screen, then delete.
Tips
- Use a staging site. If you’re not comfortable making server changes, test on a staging copy first.
- Keep backups. Before any manual deletion, download a full backup of the plugin folder and the database. This lets you restore if something goes wrong.
- Check your hosting’s file manager. Some hosts (like managed WordPress hosts) have a built-in file manager that handles permissions better than FTP.
- Consider a security plugin. Some security plugins add extra file locking. If you have one, temporarily disable it while deleting.
Troubleshooting
If the steps above don’t work, here’s what to try next:
- Error: “Could not remove the old plugin” persists after FTP deletion. This usually means the folder is still there. Check if the folder is empty. If it has files that can’t be deleted (e.g., due to immutable attribute), you may need to use your hosting’s file manager to delete it. If that fails, contact your host support.
- Error: “Destination folder already exists” when reinstalling. This means the folder wasn’t completely removed. Go back to FTP and ensure the folder is gone. If it’s empty but still exists, delete it manually.
- WordPress still shows the plugin as active after deletion. As in Step 4, edit the
active_pluginsoption in the database. If you’re not comfortable with phpMyAdmin, use a plugin like “WP Reset” or a database management plugin, but be careful. - FTP says “Permission denied” when deleting. This is a server-side ownership issue. You may need to use your hosting file manager (which runs as the server user) or contact support to change ownership.
- Site becomes broken after deleting the folder. If you deleted the wrong folder, restore it from backup immediately. If you deleted the right one but the site still errors, check that you didn’t remove a folder that other plugins depend on (rare).
Frequently Asked Questions
Why does WordPress say “Could not remove the old plugin” during an update?
This typically happens when the plugin folder is not writable by the web server user. The update process tries to delete the old folder to replace it with the new version, but fails due to permissions or ownership.
Can I just delete the plugin folder via FTP?
Yes, that’s the most reliable fix. Deleting via FTP bypasses WordPress’s own deletion logic. Just make sure you delete the correct folder and that the plugin isn’t active (or you deactivate it first).
Will deleting a plugin via FTP remove its data from the database?
No. Deleting the folder removes the code, but any options, tables, or settings the plugin created remain in the database. If you want to remove those too, you need to uninstall the plugin properly (which runs its uninstall script) or manually clean the database.
What if I can’t access FTP or file manager?
If you don’t have FTP credentials, you can use your hosting control panel’s file manager. If that’s not available, contact your host support and ask them to delete the plugin folder for you.
Is it safe to edit the active_plugins option in the database?
Yes, if you’re careful. Always back up the database first. Only remove the specific plugin path that matches the deleted plugin. If you remove too much, you could deactivate all plugins, which might break the site.
Why does the error happen only with some plugins?
Some plugins have more files or specific file structures that trigger permission issues more often. Also, plugins that were installed manually (via FTP) may have different ownership than those installed via the WordPress admin.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Hide Unhide Rows Columns Sheets in Excel
- How to Root Galaxy Note: Step-by-Step Guide
- Belmont’s Curse Paris Streets to the Fallen Walkthrough5.00 min/km
- Can AI Models Trained on NVIDIA GPUs Run on Other Hardware?
- OLED Burn-In Prevention: Tablet Guide
- Atmospheric Carbon Capture True Costs