Skip to content

How to fix "Destination folder already exists" in WordPress

WordPress found a folder with the plugin's or theme's name already in place, and stopped before changing anything. If the plugin is installed, activate, update or replace it. If the folder is a leftover from an install that did not finish, move it out and install again.

By
WP Ministry
Published
Tested on
WordPress 7.1.3, PHP 8.3.35

In short

  • The install stopped before it touched anything. The folder that was there is still there, and the site runs as before.
  • If the plugin is on the Plugins screen, it is installed. Activate it, update it, or replace it with your zip.
  • Since WordPress 5.5, an uploaded zip of an installed plugin gets a comparison and a "Replace current with uploaded" button.
  • If the plugin is not on the Plugins screen, the folder is a leftover. Move it out of the plugins folder and install again.
  • With WP-CLI, wp plugin install with --force clears the folder and installs in one step.
  • Removing a folder by hand removes files only. The plugin's settings stay in the database.

WordPress installs each plugin and theme into a folder of its own, inside wp-content/plugins or wp-content/themes. "Destination folder already exists." means a folder with that name, and something in it, was there before the install began. WordPress does not write over files it finds in its way, so it stopped. In most places it adds the folder's path and "Plugin installation failed." or "Theme installation failed."

Nothing has been lost. WordPress stopped before it touched the folder: what was in it is still there, and the site runs as it did a minute ago.

Where the message still ends the install

Since WordPress 5.5, uploading a zip of a plugin that is already installed no longer stops here. The line still shows, but under it come "This plugin is already installed.", a table comparing the two versions, and a button, "Replace current with uploaded". For a theme the heading is "This theme is already installed." and the button is "Replace installed with uploaded".

The message is final in these cases:

  • On the Add Plugins screen, where the plugin's card shows "Installation failed: Destination folder already exists." That screen offers "Install Now" only when it finds no plugin in a folder of that name, so the folder holds something WordPress does not recognize as a plugin.
  • After an upload, when the folder has no working plugin or theme in it. With nothing to compare, WordPress prints the message and the path and offers no button.
  • In WP-CLI, when it installs from a zip file into a folder that exists, or by name into a folder with no working plugin in it.
  • On WordPress older than 5.5, which has no comparison screen.

Where it goes wrong

A page request passes through each of these in turn. This one comes from WordPress itself.

  1. Browser
  2. DNS
  3. HTTPS
  4. CDN or firewall
  5. Web server
  6. PHP
  7. WordPress (this error comes from here)
  8. Database and files

What causes it

How to fix it

Use the copy that is already installed

  • Easy
  • Low risk
  • About 5 minutes
  • Steps tested on WordPress 7.1.3

If the plugin or theme is on the site already, there is nothing to install.

  1. Step 1: Look for it in the list

    Open Plugins, then Installed Plugins. For a theme, open Appearance, then Themes. Anything listed there is installed, whether or not it is active.

  2. Step 2: Activate it, or update it

    Click Activate under the plugin's name. If WordPress offers an update for it, take a backup and update it from the same screen. How to safely update WordPress, plugins and themes covers backing up first and updating one thing at a time.

  3. Step 3: If it is not in the list

    Then the folder is a leftover, and WordPress cannot use what is in it. Go to the last fix on this page.

With WP-CLI, these list what WordPress counts as installed:

bash
wp plugin list
wp theme list

Then update the plugin and switch it on, with the name from the first column in place of plugin-slug:

bash
wp plugin update plugin-slug
bash
wp plugin activate plugin-slug

To undo it: Deactivate the plugin again on the Plugins screen.

Replace the installed copy with your zip

  • Easy
  • Back up first
  • About 10 minutes

This is the way to update a plugin or theme that does not update from the dashboard, such as one bought from its maker. It needs WordPress 5.5 or later.

  1. Step 1: Upload the zip

    Open Plugins, then Add Plugin (older versions of WordPress call it "Add New"). Click Upload Plugin, choose the zip file, and click Install Now. For a theme, open Appearance, then Themes, then Add Theme, then Upload Theme.

  2. Step 2: Read the comparison

    Under "This plugin is already installed." a table sets the "Current" copy beside the "Uploaded" one: name, version, author, and the WordPress and PHP versions each requires. Check that it is the same plugin and the version you meant to install. If the uploaded version is older, WordPress warns that you are about to go back a version.

  3. Step 3: Click "Replace current with uploaded"

    WordPress removes the installed files and puts the uploaded ones in their place. "Cancel and go back" leaves everything as it was.

If the server's PHP or WordPress version is too old for the uploaded copy, WordPress lists the reason and shows no replace button. If you see the message and the path with no comparison at all, the folder is a leftover: use the last fix on this page.

To undo it: Upload the zip of the version you had and replace it again, or restore your backup.

Install over the top with WP-CLI

  • Takes care
  • Back up first
  • About 5 minutes
  • Steps tested on WordPress 7.1.3

WP-CLI's --force flag is described as: "If set, the command will overwrite any installed version of the plugin, without prompting for confirmation." It also clears a leftover folder that WordPress does not list as a plugin, which the description does not say.

For a plugin from the WordPress.org directory, use the folder's name in place of plugin-slug:

bash
wp plugin install plugin-slug --force

For a zip file on the server, give its path in place of plugin.zip:

bash
wp plugin install plugin.zip --force

For a theme:

bash
wp theme install theme-slug --force

WP-CLI removes the old folder, installs the new one, and ends with "Success: Installed 1 of 1 plugins." A plugin that was active stays active, and its settings are untouched, because only files are replaced.

If it stops with a message about files that could not be copied or removed, the account running the command is not allowed to change them. WordPress file permissions explains who should own the files and what to ask your host. If WP-CLI is new to you, How to use WP-CLI covers connecting over SSH and checking that it is installed. In the WP-CLI command builder you choose a job, fill in what it needs, and copy the command with its flags in place.

To undo it: Install the version you had with --version, or restore your backup.

Move the leftover folder out, then install again

  • Takes care
  • Back up first
  • About 15 minutes
  • Steps tested on WordPress 7.1.3
  1. Step 1: Open the folder named in the message

    Use your host's file manager, or connect over SFTP. Plugins are in wp-content/plugins, themes in wp-content/themes. The message gives the full path.

  2. Step 2: Look inside

    A leftover has part of a plugin in it: some files and folders, with the plugin's main PHP file missing or cut short. That is why WordPress does not list it.

  3. Step 3: Keep a copy, then take it out of the plugins folder

    Download the folder to your computer, then delete it on the server. Or move it out of wp-content/plugins, which does both at once.

  4. Step 4: Install the plugin again

    Install it the way you tried before. This time there is nothing in the way.

  5. Step 5: Check the plugin, then delete the copy

    On the Plugins screen, make sure the plugin is there and active. WordPress switches a plugin off when it cannot find its main file, so you may need to click Activate.

Over SSH, from the folder WordPress is installed in, with the folder's name in place of plugin-slug:

bash
ls -la wp-content/plugins/plugin-slug
bash
mv wp-content/plugins/plugin-slug wp-content/plugin-slug-leftover
bash
wp plugin install plugin-slug --activate

When the plugin works, delete the copy:

bash
rm -r wp-content/plugin-slug-leftover

Moving or deleting a folder by hand removes files and nothing else. The plugin's settings are in the database, and are there when the plugin comes back. Deleting a plugin with the Delete link on the Plugins screen is different: that is the moment a plugin is expected to remove its own options and tables.

wp plugin delete will not clear a leftover. WP-CLI finds no plugin by that name and leaves the folder where it is.

If the folder cannot be moved or deleted, the account you are signed in with is not allowed to change its files. WordPress file permissions explains ownership and what to ask your host to put right. If the folder was left by an update that also broke the site, A WordPress update went wrong: a runbook puts the steps in order, and a site stuck on a one-line maintenance notice is covered in "Briefly unavailable for scheduled maintenance".

To undo it: Move the folder back to where it was.

When to get help

If the folder cannot be moved or deleted even from the hosting panel, or the site shows an error of its own once the plugin is back, the trouble is in who owns the files or in what the interrupted update left behind. Both are settled faster with access to the server than by installing again and again.

Common questions

Will I lose the plugin's settings?

Not by any fix on this page. Replacing a plugin from a zip, installing with --force and moving a folder by hand all change files only, and settings are kept in the database. They can be removed when you delete a plugin from the Plugins screen, because that runs the plugin's own clean-up.

Why is there a folder when the plugin is not in my list?

WordPress lists a plugin only when it finds the plugin's main file. An install or update that stopped partway, or a delete that could not remove every file, leaves a folder with that file missing. The folder is enough to block a new install and not enough to count as a plugin.

How do I stop it happening again?

Keep the tab open until WordPress says an install or update has finished, and do one at a time. Trying a plugin on a staging copy first keeps a failed install away from the live site: How to choose a WordPress plugin shows how.

More on this subject

Would you rather we fixed it?

Quick Fix is $49. One issue, one site, up to about an hour. No fix, no fee. 30-day warranty. It starts with a free diagnosis.