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:
- Access to the CPanel to the domain (for FileManager)
- Latest WordPress files (download from www.wordpress.org)
- 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:
- Uploading the WordPress files
- Starting WordPress installation (to create config.php with MySql db and user details (or using new password with exiting DB User))
- Then running upgrade of the WordPress
- 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
- Download latest WordPress Installation files from WordPress.org.
- UnCompress (Extract/Unzip) the installation file into a folder on your hard drive.
- Now go inside the wordpress folder and select all files and compress them into a zip file, say wordpress.zip
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:
- Open File Manager
- 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.
- Upload the wordpress.zip to the Web Root folder
- Decompress (Extract/Unzip) the wordpress.zip 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:
- Database name
- Database username
- Database password
- Database host
- 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 example.com 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.