6735 2
How-to 27 min read April 25, 2022

The Ultimate Guide on How to Secure Your WordPress Website

The Ultimate Guide on How to Secure Your WordPress Website
The Ultimate Guide on How to Secure Your WordPress Website

Sr. Content Writer at SDK Marketing
Cyberattacks are a prominent problem that for many years has hindered the growth of online businesses around the world.

That is why securing online platforms, including WordPress websites, should be one of the top priorities for companies and individuals alike. So, what can we do to prevent hackers from breaching our system?

In this article, we will dive deeper into the importance of WordPress security and how to secure WordPress sites more effectively.

Why WordPress Security Is Important

It is estimated that around 30,000 websites are hacked daily worldwide. Combined with the fact that WordPress powers the majority of websites, cybersecurity should be a top concern of all WordPress users.

There are 12 common security vulnerabilities WordPress websites face, including:
If your website falls victim to any of these security issues, there are numerous disadvantages depending on the attack’s severity and what kind of data is stored on your website.

Dealing with website security breaches can be costly. According to Sumo Logic, the average cost of a cyberattack in 2020 was around $133,000. This may consist of the cost of data recovery and compensation to any affected parties like clients or investors.

Aside from financial damage, handling a security breach is also time-consuming. The time you’d otherwise spend on improving site performance and attracting more visitors would now be focused on recovering from the attack.

How to Secure Your WordPress Website

Even though security breaches can significantly hinder website management, there are various ways to secure your WordPress site from these attacks. Here are 12 WordPress security tips to consider.

Choose Secure WordPress Hosting

Hosting is a crucial aspect of any website’s performance quality. Choosing the right hosting provider should therefore be the first step in ensuring your website works as expected.

The best approach for WordPress users is to look for a hosting service that is fine-tuned for this content management system (CMS).

Many providers offer WordPress hosting with features that allow WordPress websites to perform at their best. This is different from regular web hosting which = is more generalized and designed to cater to a wider range of website building platforms.

WordPress hosting typically includes services like one-click installation and plugin optimization, which can help ease various site management tasks.

Most WordPress hosting services are also designed to better prevent WordPress-specific security issues. Features such as automatic software updates and specialized customer support can strengthen your WordPress website’s protection against common vulnerabilities.

There are two main ways to know whether your WordPress hosting of choice can provide enough security for your website.

First, research what customers say about their service. Look for online reviews and visit the web host’s social media accounts to see how often customers complain about the hosting’s security.

Second, a good hosting company will ensure its support is easily accessible by providing multichannel and 24/7 customer service. The last thing you’d want is to face a security problem with your website and wait too long to get it resolved.

Set Up a Web Application Firewall

A web application firewall (WAF) is a service that monitors data transfer traffic to and from a web service. It prevents unauthorized software from accessing the network and potentially injecting malware or leaking sensitive information.

There are two types of WAF currently available for WordPress websites.

A cloud-based firewall operates at the server level and monitors your hosting infrastructure. It only allows legitimate traffic and blocks any malicious requests coming to your WordPress site before they reach the webserver.

Aside from enhancing WordPress security, a cloud-based firewall also helps reduce the load of your WordPress hosting and can potentially improve its availability. Therefore, these firewalls are often considered a primary option.

Another WAF type to consider is the plugin-based firewall. As the name suggests, this WAF type comes as a plugin that is installed on your WordPress site. Unlike the cloud-based option, these firewalls examine traffic and requests once it reaches the server, but before loading most WordPress scripts.

Which WAF type to choose depends on your needs and preferences, since these two options offer different capabilities and pricing models. There are numerous brands offering different WAF types, which means WordPress users have many options.

Some popular WAF brands for WordPress sites include Sucuri, Cloudflare, and Wordfence.

Enable Two-Factor Authentication

Two-factor authentication (2FA) is one of the most common ways to protect online accounts from malicious login attempts. It adds an additional verification step during the login process, typically using a randomly-generated code sent to a previously-verified device.

There are three main 2FA categories, including:
  • Knowledge factors – users need to input secret information, such as a PIN, password, or by answering security questions.
  • Possession factors – users need to authenticate their login attempts using a previously-verified device, such as a mobile phone, a thumb drive, or a card.
  • Inherence factors – users need to authenticate their login using biometric identification, such as voice recognition, a fingerprint reader, or a retinal scan.
This security measure works well when combined with a strong password to prevent common threats, especially a brute force attack carried out by AI. A report from Microsoft concluded that 2FA works, blocking 99.9% of automated attacks.
WP 2FA
WP 2FA
Based on this data, it is safe to say that 2FA is a must-have WordPress security measure. Some popular plugins like WP 2FA and Google Authenticator can help WordPress site owners enforce administrators and users to use this security method.

Keep Your WordPress Website Updated

According to WordPress statistics, more than a quarter of its users are still running on versions below 5.0. This means that a considerable number of WordPress sites are exposed to various risks such as malware and hacking.

Outdated WordPress websites tend to be more vulnerable to cyberattacks since the core files of older WordPress versions are more easily exploited by hackers.
Because of that, it is in your best interest to use the latest version of WordPress.

WordPress will send notification emails whenever an update is available. With each update and patch, the developers of WordPress may fix numerous bugs and security issues, as well as enhance performance.

Aside from the WordPress core files, it is also important to regularly update your installed plugins and themes. These pieces of software may also contain vulnerabilities that hackers can exploit to breach your website and steal its data.

Since manually updating numerous plugins and themes can be time-consuming, consider turning on an auto-update feature. Some WordPress hosting providers also offer automatic updates via their control panel.

Install a Security Plugin

The extensive WordPress plugin library is one of the reasons why this CMS is popular among website owners and developers. These plugins offer various functions, such as improving page load speed and adding more features.

There are also numerous security plugins to choose from with different features that can enhance your website security. For example, plugins like Anti-Malware Security and Malcure WP Malware Scanner can scan and remove malicious files from your site.
Malcure WP Malware Scanner
Malcure WP Malware Scanner
WordPress backup plugins, such as UpdraftPlus and Jetpack Backups, can also give you a safety net in case a breach occurs and compromises your website files. Other common features of security plugins include detecting malicious traffic, filtering spam comments, and managing users' access.

WordPress security plugins come with different pricing plans. While a premium plugin can offer enhanced features, those with a limited budget can use a free plugin.

However, keep in mind that some WordPress plugins are not compatible with each other and may cause errors. Read plugin reviews and look through threads on online forums to determine the best WordPress security plugins and check for compatibility.

In general, the best approach is to limit how many plugins you install or activate.

Manage User Access

Managing user access to your WordPress site is one of the key ways to maintain WordPress security. WordPress itself has a built-in user management system that allows you to define roles and permissions for users on your website.

This feature can help prevent unauthorized persons from modifying or abusing sensitive information on your WordPress site. Take a look at this table to know more about the six predefined user roles on WordPress:
User roles on Wordpress
User roles on Wordpress
Every WordPress user needs to understand how these roles work and manage them appropriately. Some plugins like PublishPress Capabilities can help administrators of a large-scale website to manage user access more efficiently.

Protect with Strong Passwords

The first line of protection for your online accounts is typically a username and password. However, one of the most common types of security breaches is a brute force attack, which works by generating numerous possible passwords to infiltrate a private account.

From May until mid-June of 2021, brute force attacks targeted 26% of all organizations per week on average. One of the best ways to prevent this type of attack is to use strong passwords that are not easily guessed by hackers.

What is <input type = "password"> and how does this field threaten the user's security

A secure password needs to be unique. Avoid using personal identities like names, birthdates, and hometowns in your password. This type of information can be easily guessed since most of it is publicly available through platforms such as social media.

It is also not advisable to use the same password on multiple accounts because this might allow a hacker to take over numerous accounts at the same time.

Other qualities a strong password needs to have are length and complexity. Longer passwords containing combinations of uppercase and lowercase letters, numbers, and special characters are typically harder to crack.
BitWarden Password Manager
BitWarden
Since remembering multiple long and unique passwords can be difficult, use password management software to help. Examples of popular password management tools include 1Password, LastPass, and BitWarden.

Limit Login Attempts

Another way to prevent brute force attacks on your website is by limiting login attempts. By default, WordPress allows users unlimited attempts to enter usernames and passwords, which makes hacking much easier.

However, it is possible to limit the number of login attempts so that users are locked out of a WordPress account after a certain number of failed attempts. This can be controlled using a security plugin called Limit Login Attempts Reloaded.

After installing the plugin, go to the WordPress admin page and look for the Settings tab. Then, click on the Limit Login Attempts page. This plugin allows you to set the maximum number of login attempts for each account and how long the lockout period will be.
Wordpress login menu
The plugin will also send a notification email to the administrator after an account has been locked to a certain user. With this feature, you’ll have more time to conduct additional security measures to prevent potential attacks.

It is also possible to enable a login attempt limit without using a plugin. However, this method is relatively more complex and requires more advanced technical knowledge, since you’d have to input custom code into your WordPress functions.php file.

Disable WordPress File Editing

When a hacker breaches your site’s system, they may attempt to modify the WordPress core files and change how the site behaves. By default, users with administrator roles are also allowed to edit code for themes and plugins directly from the dashboard.

This exposes your site to multiple security risks. One way to prevent this from happening is by disabling the file editing feature in your WordPress admin. To do this, you’ll have to use a file transfer protocol (FTP) or file manager from your hosting control panel.

Use either of these to access the site’s wp-config.php file and open it using a text editor. Then, add the following code above the line that says /* That's all, stop editing! Happy blogging. */ :

define( 'DISALLOW_FILE_EDIT', true );
Once you finish the process, save the file and go back to your WordPress admin dashboard. If you do this correctly, the option to edit themes and plugins should disappear.

A WordPress security plugin like Sucuri also offers a one-click hardening feature that allows you to protect crucial files without adding code manually.

Run a Regular Website Scan

Your website might have malicious code and malware that go unnoticed, which can infect users’ devices or steal sensitive information from your website. According to Purplesec, over 18 million websites are infected with malware at a given time each week.

That is why it is important to run full scans to ensure your website is clean and safe to use. Scanning should be done regularly because most malicious code can run in the background without showing any significant signs until it is too late.

An infected website can experience several other disadvantages, too. Search engines like Google and Bing usually give penalties to websites they deem as compromised and pose security risks to users. This results in a lower search engine results page (SERP) ranking that can significantly impact your website’s traffic.

Malicious code can also throttle your site’s performance. Some hackers can plant malware that uses your web server resources to power their attacks on other websites. This means a slower page load speed that results in a bad user experience.

Not to mention that when a malware spread is traced back to your website, it can hurt your authority and reputation.

Regular website scanning can be done using anti-malware or all-in-one WordPress security plugins. Don’t forget to back up your website files before conducting malware scans in case some core files are accidentally deleted during the process.

How to check websites for viruses

Change Login URL

Some attacks require the perpetrator to know your login URL. This is the link that directs you to the login page of your WordPress admin dashboard. By default, you only need to add /admin, /login, or /wp-login.php after your site’s URL to reach the WordPress login page.

Since the default is the same for every WordPress site, hackers can easily access the login page if you don’t change it to a custom one. That is why we recommend you implement this method as a way to distance your site from potential cyberattacks.

You can change your login page either manually or using a specific plugin. 

However, we encourage you to use plugins since manually editing the WordPress core files may result in errors that can harm your site’s functionality. It is also more inconvenient since you’d have to recreate a new login page file every time you update WordPress.
WPS Hide Login
WPS Hide Login
Two of the most popular plugins for this are WPS Hide Login and Change wp-admin login. They are fairly easy to use and all you have to do is enter your new login URL and the redirection URL.

This redirection URL will trigger when someone tries to access your original login URL and the wp-admin directory while not logged in. You can create a new page for this URL or redirect it to your homepage.

The new login URL will be effective immediately after you click the save button on the plugin’s Settings page. To revert back to the original URL, all you need to do is remove the plugin from your WordPress.

Always Use a Secure Connection

Every time you exchange data through the internet, there is a chance that the process gets interrupted by a third party without your knowledge. This third party can be hackers who use your data for malicious purposes.

Because of that, the best practice for using the internet is by having your data encrypted. From a website owner’s perspective, one of the best methods to secure connections to your site is to use an SSL (Secure Socket Layer) certificate.

It authenticates your site’s identity and creates an encrypted connection between your web server and visitors’ web browsers. When a site implements SSL, it changes its protocol from HTTP to HTTPS (HyperText Transfer Protocol Secure) and users can identify it by looking at the URL.

HTTPS has become the standard and is used by more than 78% of all websites. Most web browsers will also notify their users when they try to visit a site without HTTPS by marking it as Not secure.

Website owners can get SSL certificates from their hosting provider. Pricing for this service may vary significantly depending on your security specifications and needs. The process of applying SSL and switching to HTTPS is also relatively simple and most of the time the hosting provider will help you through the technical process.

How to update a sitemap when switching to the HTTPS protocol

How to Fix a Hacked WordPress Website

Even after you implement multiple methods to improve your WordPress security, the possibility of it getting hacked still exists. Because of that, it is crucial to know how to fix your site when it falls victim to a cyberattack.

In this part of the article, we will go through a few methods and steps you can take when your WordPress website is compromised. Keep in mind that this is a general guide, and the necessary process to recover your site might vary depending on the severity of the attack.

Make Sure Your Site Is Actually Hacked

First, make sure that your site is actually being hacked. There are several signs that indicate if your WordPress site is compromised, including:
  • A defaced homepage
  • Inability to log in to the admin dashboard
  • Suspicious user accounts appearing
  • Users being redirected to a malicious or spammy website
  • A slow or unresponsive website
A good hosting provider will typically alert its users when they detect any suspicious activity in the server, so pay attention to the alerts they may send you.

Change Your Password

It is important to change your login credentials immediately to prevent the hacker from maintaining access to the site. It is also recommended to change your security keys since hackers can decipher your credentials once they get access to these codes.

Check Recently Modified Files

Take a look at any newly modified files in your WordPress to identify which file has been affected by the hack. If you have access to the web server’s SSH, it is possible to identify all the files that were modified within the last ten days using this command:

$ find ./ -type f -mtime -10
If you haven’t changed any files within that time period, you are likely to find the affected files using this method. After that, you have the option to edit or delete the files to recover your site from the attack.

Some security plugins also allow you to scan malicious files more easily without having to use this method.

Remove Suspicious User Accounts

If you notice there are unrecognized and unused user accounts on your site, consider deleting them immediately. Hackers might gain access by creating new accounts with admin roles to modify various elements of a site.

Go to the WordPress admin dashboard and click on Users then All Users. You will see the list of accounts within your site along with their respective roles. Pay close attention to users with admin privileges and delete the ones you don’t recognize.

Use Google Transparency Report

Google provides a tool called Safe Browsing that can examine your site’s URL and inform whether it is considered dangerous to visit due to a possible hack. This is a helpful tool to double-check your site’s status after recovering it post-hack.
Safe Browsing tool by Google
Safe Browsing

Backup Your Site

After you ensure that the website is safe and recovered, it is time to create a fresh backup. This makes it possible to recover the site data more quickly in case other attacks occur in the future.

Consider storing this backup in an offsite location to avoid getting it compromised during a potential hack.

Contact Your Hosting Provider

Many consider this the best way to solve a cybersecurity problem on your website. The support team from your hosting provider will typically help overcome any technical issues you might face, including any hacking cases.

However, note that the standard procedure in some hosting companies when receiving a hacking report is to delete the entire site data to prevent the attack from spreading, which might not be an ideal solution. If this is the case for you, consider this method as a last resort.
Now that you've made sure your website is secure, would you like to let Serpstat help you promote it?
Click the button below, sign up and get a 7-day trial and test the capabilities of the platform for free!

Conclusion

Cybersecurity is one of the most important factors to consider when running a website. This is especially true if you use WordPress since the platform is widely targeted by hackers due to its popularity.

In this article, we explored why improving security measures is important for your WordPress website. We also looked at 12 essential methods website owners can use to prevent cyberattacks, which are:
  • Choose secure WordPress hosting
  • Set up a web application firewall
  • Enable two-factor authentication
  • Keep your WordPress website updated
  • Install security plugins
  • Manage user access
  • Protect with strong passwords
  • Limit login attempts
  • Disable WordPress file editing
  • Run regular website scans
  • Change the login URL
  • Always use a secure connection
Now that you know the importance of WordPress security and how to maintain it, it is time to practice it on your website. Follow the tips presented in this article to protect your WordPress site against potential cyberattacks.
To keep up with all the news from the Serpstat blog, subscribe to our newsletter. Also, follows us on LinkedIn, Facebook, and Twitter ;)

Speed up your search marketing growth with Serpstat!

Keyword and backlink opportunities, competitors' online strategy, daily rankings and SEO-related issues.

A pack of tools for reducing your time on SEO tasks.

Get free 7-day trial
The opinion of the guest post authors may not coincide with the opinion of the Serpstat editorial staff and specialists.

Rate the article on a five-point scale

The article has already been rated by 4 people on average 5 out of 5
Found an error? Select it and press Ctrl + Enter to tell us

Discover More SEO Tools

Tools for Keywords

Keywords Research Tools – uncover untapped potential in your niche

Serpstat Features

SERP SEO Tool – the ultimate solution for website optimization

Keyword Difficulty Tool

Stay ahead of the competition and dominate your niche with our keywords difficulty tool

Check Page for SEO

On-page SEO checker – identify technical issues, optimize and drive more traffic to your website

Share this article with your friends

Are you sure?

Introducing Serpstat

Find out about the main features of the service in a convenient way for you!

Please send a request, and our specialist will offer you education options: a personal demonstration, a trial period, or materials for self-study and increasing expertise — everything for a comfortable start to work with Serpstat.

Name

Email

Phone

We are glad of your comment
I agree to Serpstat`s Privacy Policy.

Thank you, we have saved your new mailing settings.

Report a bug

Cancel
Open support chat
mail pocket flipboard Messenger telegramm