A Helpful Guide to Fixing a hacked website

If you have ever found that your Wordpress website has been hacked, or it has recently been hacked would you know what to do in such an instance? In the following article we show you how to wrestle back control of your website and put in place measures to reduce the risk of it happening again.

Your online business is doing really well, many of your products are selling at a steady clip and feedback on your service is very positive. A sense of ease pervades and you are able to put your feet up, relaxing as your website continues to perform admirably. The world is all sunshine and rainbows, or so it seems.

After a couple of months of solid growth and target-beating performance, you notice a sudden drop off in traffic and an influx of concerning emails regarding your website. Something isn’t working right, you go online and have a look for yourself and begin to navigate through your website. Someone has hacked your site, links to your products now lead offsite to different pages and some of the images have been replaced and you don’t quite know how or why this has happened.

So what do you do next? Other than panic and eff-and-blind (swear profusely) there isn’t much you can do. Or is there? Yes, do not panic… take a breath, and collect your thoughts. We are here to help with several steps to take to either resolve issues from being hacked, or how to respond before this becomes an issue. It’s a royal pain in the arse when someone ruins something you have worked so hard to build, by following a few simple steps you can ensure that you can recover operational capacity should anything bad happen.

1: Continually Make Sure You ‘Backup’

Many people who have a Wordpress-built website overlook the need of a ‘Backup’, if something goes wrong with your site. Or you get hacked, having a backup gives you the opportunity to roll back your website to an earlier version (before these issues existed) and then resolve the issues before going live. Backing up your site also enables you to fix things should you do something wrong and break your site. It’s an archived record of your website in its entirety before the wrath of the digital demon gods wrought their havoc on your website.

The frequency of when you should make your backups depends on the consistency of your output, if you’re posting or updating your website multiple times a day/week, you should backup your website more frequently.

There are two main components of your Wordpress website which you need to backup, some of the cheaper web hosts claim they also back up your website. But they often only backup MySQL (My Structured Query Language, an open-source ‘Relational Database’). They don’t backup your files, which means if you experience any problems you will lose any changes you may have made to your themes, or images. If you ever corrupt your site, or are the victim of hackers it can be difficult or nigh on impossible to retrieve a backup from your web host. This is why backing up your site manually is always a much better option… peace of mind and all that.

There are two ways of backing up your site, which are both fairly simple. First you have the manual method using FTP (File Transfer Protocol) or SFTP (Secure File Transfer Protocol), this is explained below.

To backup your Wordpress website, you should have an FTP/SFTP client installed on your computer to access your web hosting service, FileZilla and CyberDuck. For example I use MAMP Pro on the Mac. Using this software you can download all your Wordpress files to your computer. If it is your first time backing up your computer you should go ahead and download the entire folder to your computer. If you are updating your back up, you need only copy the updated (modified) or newly files.

Wordpress stores your website databases in tables. By default these tables have the prefix  wp_ to be immediately recognisable. To ensure you can retrieve all your website data, you need to backup all these tables. Media has to be saved separately, just in case it doesn’t back up.

The FTP/SFTP client you use will access PHPMyAdmin a free tool used for administering MySQL over the internet.

It may initially seem quite a daunting process, but it is so easy that you can make a backup in the time it will take you to brew a nice mug of tea. Follow these steps to first backup your Wordpress site:

  • Log into your web host and navigate to cPanel, on most web hosts cPanel is often the first page you access when you login.
  • Navigate to the File Manager, which will lead you to your Home directory or public_html.
  • From here you can locate your Wordpress directory, this is the folder you will want to back up.
  • However you can’t download the Wordpress folder without compressing it. This isn’t a lengthy process and can be done fairly quickly.
  • Click on your Wordpress directory and select ‘Compress’ from the menu, or right-click on the folder and select ‘Compress’ from the drop-down menu.
  • Select the file-type you wish to download the directory as, I always recommend downloading as a .zip file type.
  • Following this, just select ‘Compress File(s) and let the compression process begin, it automatically saves this .zip file of your Wordpress directory to your server.
  • Once this process is done, download a copy to your computer. Click on the the newly created archive and choose ‘Download’.
  • Choose where you wish to save it. I would also recommend storing it externally from your computer, either on an external hard-drive/USB drive, or a cloud service of your choice. Always backup your backups, just in case something happens to your computer.
  • That’s it! The process is completed and you now have your site backup.

So how do you backup your site using web software? On Wordpress, you can download a plethora of plugins to help you with backing up your site. The advantage to these web applications can work automatically, backing up as per your own preference. I stated in a previous post my chosen plugins for backing up my Wordpress website.

You can see more on this here.

Download your Wordpress database Manually

Now you have backed up your Wordpress files, now we need to backup the Wordpress database.

This is a simple process featuring only a few steps.

  • Navigate to cPanel and locate phpMyAdmin. It can be found under ‘Database Tools’
  • Login, this will lead you to the phpMyAdmin admin panel. 
  • Click on ‘Databases’ tab, this will list all your databases. 
  • From your ‘File Manager’, go to your Wordpress directory and find the wp-config.php file. Right-click on wp-config.php and chose the ‘View’ option.
  • In the window that opens, locate the line that features the following:
    define('DB_NAME', ‘database_name’);
  • Your database name is the one located inside the second set of quotation marks, which is the bolded ‘database_name’ in the example above. Now you have the necessary info, find your database in PHPMyAdmin and open it. 
  • Now select all the tables you wish to backup (or ‘Check All’ to select all at once). Once you have selected the required tables, hit the Export tab option. Select the export option and set the format to SQL.
  • Hit the ‘Go’ button and save your database to your computer, making sure to back up in the same storage mediums as your Wordpress files. Double your backups and that’s it.

2: Identify whats going on

Assess exactly what is wrong with your Wordpress. What is the issue caused by hacking and how can you fix it. Once you have a clear insight into what is afflicting your website, you can come up with a clear idea of how to resolve the issues with your Wordpress website.

Scan your local machine, this will help you narrow down what possible threats there may be in the locality. Run your chosen ‘Anti-Virus’ software and let this run to completion, also run a malware scan on your machine to check for local threats. Undertaking this process will check for a variety of threats that may be contributing to your hacking problems. A quick google search will help you find a variety of free tools to do this in conjunction with the Fixhacked software.

3: Contact your host

Log into your web hosting account, contact their support team and raise a support ticket requesting additional help. They should be able to assist with the tracing and tracking of any and all hacking issues you face and possibly provide some insight into what the possible causes for these are.

4: Harden Your Wordpress

Limit access. This should be a given in the instance of any hacking problems. If possible change your cPanel and Wordpress passwords, change these for everyone who has access to your Wordpress site. If only you have access to your site, I recommend changing your passwords on a frequent basis, I personally do this on a monthly basis, even when I am not subject to attempts to brute-force access to my Wordpress. Many hacked sites are usually easily accessed in ‘brute-force’ password attempts by hackers who continuously attack a website in an attempt to guess the admin access password.

Reduce the opportunity for hackers to access your Wordpress or site administration tools. By configuring your wpconfig.php file you can increase security on your Wordpress site. I previously recommended an excellent tutorial on how to do this.

I would always recommend that you use a lengthy password (around 16 characters), a combination of letters in lower and upper-case, punctuation and numbers. A password that features a 16 character mixture is far harder to brute-force than a typical 8 character password combination.

5: Use Our Scanner To Find Issues With Your Website

Download our free scanner, this scans your site and all your files and folders (libraries), highlighting any issues, malware or exploits your site may be afflicted by. 

Following the scan we will let you know which files are corrupted, and those which could have been exploited. This will provide you with a means to finding a solution to remedy these issues. Giving you the opportunity to clean up these issues quickly and easily.

6: Fix website with the scan results

A Fixhacked scan will check all of your files and folders for exploits, highlighting these so you can either make the necessary amendments. A Fixhacked scan will also detect any other potential exploits and corrupted files, giving you advice on how to remedy these problems.

Should you require additional help and support, you can ‘Hire An Expert’ who will be able to assist you with rectifying all the damage caused.

In some cases, the damage caused necessitates that the site is taken offline (put into ‘Maintenance Mode’) whilst the issues are resolved. If your website has been compromised to such an extent it is often best you ‘roll-back’ to a state before the problems arose. From here you can then plug any of the holes in your files and folders in the Wordpress directory and update all the plugins to ensure any exploits on that end are resolved.

7: Monitor your site to make sure it doesn't happen again

Keeping on top of your Wordpress security and general maintenance ensures smooth site running and little to no issues on a day-to-day basis. Utilising Google Analytics and Google Webmaster Tools will give you an overview of your site metrics, ensuring you can keep track of stats and by checking these regularly enables you to counter problems as they arise. 

I would also recommend that you keep on running Fixhacked in the background on your website, these will monitor your Wordpress website and keep you up to date with any issues that may crop up.

It’s a lengthy process with many steps to take, but vigilance is key. Reactive response is also as important and if you hadn’t taken the necessary action until an issue cropped up, with Fixhacked you can consult experts who can help remedy any problems and advise you on how to ensure your experience is as smooth and efficient as possible.

Try FixHacked for free for one month

Try our free scanner!

Hire an Expert

I need an Expert


Chat with us and find out what you need to know!

Start livechat