How to recover a WordPress website or blog from accidental files delete?


This post provides help to those people who have lost their WordPress website or blog due to unintentional (or intentional by someone) deletion of all files from the folder where WordPress was installed.

Recently this happened with one of my friend. Accidentally he deleted all files from the live website’s main folder, resulting in  blank screen on the website. Somehow I managed to recover all posts and pages on the website but was not able to restore images, theme, plugins and custom code changes. But the site restored with all data – posts and pages. And that’s within minutes.

For recovering a WordPress Installation from the issue of deleted files, we need:

  1. Access to the CPanel to the domain (for FileManager)
  2. Latest WordPress files (download from
  3. MySQL Database – Username and Password OR Access to CPanel (for PhpMyAdmin) if you do not have MySQL User details.

Now the process, which I followed is described below in short:

  1. Uploading the WordPress files
  2. Starting WordPress installation (to create config.php with MySql db and user details (or using new password with exiting DB User))
  3. Then running upgrade of the WordPress
  4. Updating WordPress Database table – wp_options to use text ‘default’ for current_theme, template and stylesheet

And that’s it. You have your website/blog back.

How to recover a WordPress website or blog from deleted files

Prepare latest WordPress Installation Files

  1. Download latest WordPress Installation files from
  2. UnCompress (Extract/Unzip) the installation file into a folder on your hard drive.
  3. Now go inside the wordpress folder and select all files and compress them into a zip file, say

This will provide us with a zip file which can directly be placed in the Web Server of the domain.

Login to Control Panel of your website (like CPanel or other Website Control Panel)

This Step involves two activities to be completed – Uploading of WordPress files to the Web Server and Decompressing them:

  1. Open File Manager
  2. Go to Web Root folder i.e. public_html/www. On Linux Web Servers public_html/www is used for storing files and folders for a website.
  3. Upload the to the Web Root folder
  4. Decompress (Extract/Unzip) the file to get all wordpress files

Now we are ready to go

Now browse for your website in the web browser. You will be asked by WordPress Setup to create a Configuration File.


Move forward you will be required to enter the following details:

  1. Database name
  2. Database username
  3. Database password
  4. Database host
  5. Table prefix (as was selected earlier)

If you don’t have these values, refer to post – How to reset the mysql username’s password from control panel? 

Or you can create a new user for Mysql Database with new values for username and password, and assign the existing WordPress database to this new user. For this refer to How to create and assign a new mysql user to the existing WordPress Database?

I will be writing these posts shortly.

Enter required values as shown below:


(shown values are just for illustration, enter actual details in the form)

After you enter values, click on “Submit”. On next screen, click on “Run the Install”.


You will be presented with a message that WordPress is already installed, i.e. we have setup our WordPress.



Before you login to the WordPress, please be sure to run the upgrade by typing the following address in the browser:

Replace the with the actual name of your domain name and wordpress with the name of folder where wordpress is installed or remove /wordpress if wordpress is installed in the root of the Domain.

Now browse the website, you will be able to see the blog but without any custom theme and plugin. You can login and install those themes and plugins.

That’s it. We have restored our wordpress installation.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.