WordPress security: Our top 10 tips for an impenetrable site

By Steven, on July 28, 2023, updated on August 7, 2023 - 11 min read

Dreaming of an indestructible WordPress site safe from malicious attacks? Look no further! You’re in the right place.

In this article, Debugbar will give you all its tips for securing your WordPress website. So, ready to turn your website into a real fortress? Let’s go!

  • WordPress includes built-in security features but they are often not sufficient.
  • Not protecting your website exposes you to malicious attacks and could compromise your data.
  • There are numerous plugins available to protect your WordPress website.

The need to secure your WordPress site: Why is it so crucial?

WordPress is one of the most popular CMS out there and, even though it offers built-in security options, they pale in comparison to the ingenuity of cybercriminals when it comes to hacking.

Securing your WordPress website is not only an option, it’s a necessity because:

  • WordPress’s popularity makes it particularly susceptible to cyberattacks:your site can become a prime target.
  • Vulnerabilities, although rare, exist in WordPress. Poorly designed plugins or themes can expose your website to risks.

Practically speaking, not securing your WordPress website is like leaving the doors to your house wide open. You wouldn’t do that in real life, would you? So don’t do it on the web either.

After all, it would be a pity to lose all the data on your website due to a simple security oversight…

wordpress newpost 1

Update your knowledge: WordPress and its vulnerabilities

WordPress is undoubtedly a fantastic platform, but like everything else, it has some weaknesses. To understand how to better protect your website, it is therefore essential to understand WordPress’s main vulnerabilities:

  • Backdoors: Imagine a burglar entering your house through a hidden window instead of the main door. This is how backdoors work. They bypass usual security measures and give cybercriminals unauthorized access to your website.
  • Pharma hacks: This type of attack inserts invisible text and links into your site to promote certain products or services, usually health-related. Not only is this annoying, but it can also damage your site’s reputation.
  • Brute force login Attempts: You know when you forget your phone’s passcode and you try all the possible combinations? Well, that’s what cybercriminals do with your WordPress site. They use automated programs to guess your passwords and gain access to your site.
  • Malicious redirects: Like a magician misdirecting your attention, these attacks inject code into your WordPress website to redirect your visitors to other pages populated with advertisements or malware.
  • Cross-Site Scripting (XSS): Imagine an intruder sticking a post-it note with an annoying message on your office door. XSS attacks go a step further by sticking this post-it directly onto your website, causing damage or stealing information.
  • Denial of Service (DoS): It’s like a crowd blocking the way for an emergency vehicle, preventing it from passing. DoS attacks flood your site with requests until it can no longer respond, making it inaccessible to your legitimate users.

Becoming aware of these vulnerabilities is the first step towards enhanced security. Don’t worry, we have plenty of tips to help you combat these threats.

Also read : Swing VPN: A wolf in sheep’s clothing – Decrypting the hidden DDoS threat in your phone

Our top 10 tips for a fortified WordPress site

Now that you know the main dangers, it’s time to take action and see how to avoid them. Here is a series of tips to strengthen the security of your WordPress site. Follow the guide!

Tip No.1: Keep everything up to date

Just like your smartphone receives updates to improve its performance and fix bugs, WordPress, with its themes and plugins, also requires regular updates.

These updates often contain security patches that help protect your site against new threats. By keeping your WordPress website updated, you therefore make it less vulnerable.

So you must:

  • Not ignore update notifications. They are there to help keep your site in optimal health.
  • Not forget to update your themes and plugins. As they are an integral part of your site, their security affects the overall security of the site.
  • Delete anything that is not in use. If you have an obsolete theme or plugin that you no longer use, get rid of it. It serves no purpose other than to create potential vulnerabilities.
  • Finally, keep an eye on your security plugin. Its updates are essential to face the new threats.

It may seem tedious to keep everything updated, but think of it like regularly maintaining your car. You don’t want to wait for it to break down before you start taking care of it, right?

wordpress user 1

Tip No.2: Strengthen your line of defense with security plugins

Securing your WordPress site may seem like a daunting task, but luckily you are not alone in this battle!

There is an arsenal of plugins that can help you secure your website by beefing up your line of defense. Here are some of the most popular plugins and what they can do for you:

  • Sucuri Security: Think of it like a bodyguard who protects your site 24/7. Sucuri Security performs anti-malware scans, blocks maliciousIPs, and alerts you when something seems suspicious.
  • iThemes Security: It’s like having a personal locksmith for your site. It helps you secure your passwords, set up two-factor authentication, and detect intrusion attempts.
  • WordFence Security: Think of it as a smart watchdog. Wordfence monitors all your site’s activities in real time, performs anti-malware scans, and blocks brute force attacks.
  • WP fail2ban: Like a spam filter for your site, it protects against brute force login attempts by implementing immediate bans.
  • SecuPress: It’s like having a private detective looking for vulnerabilities on your site, proposing solutions to fix them, and ensuring your personal information stays private.
  • WP Security Audit Log: Imagine a detailed diary of everything that happens on your site. This plugin keeps a log of changes and can alert you if something unusual occurs.
  • All In One WP Security & Firewall: Like a complete alarm system for your site. This firewall offers a range of features, from brute force protection to file modification detection.

Each of these plugins offers valuable functions to protect your site. All you need to do is install the ones that best suit your needs.

Tip No.3: Play the strong password card

It’s not necessary to have a degree in computer security to understand the importance of a strong password. It’s your first line of defense against cybercriminals.

It’s a bit like the lock on your house’s door: the more complex it is, the harder it will be for burglars to get in. So, how do you create a strong password?

  • LCU: Create a Long, Complex and Unique password:
    • Length: The longer your password, the better. Aim for at least 8 characters, but don’t hesitate to go further.
    • Complexity: Don’t settle for the classic “123456” or “password”. Instead, use a combination of lowercase and uppercase letters, numbers and special characters to increase the difficulty.
    • Uniqueness: Avoid using the same password for different accounts. If a hacker discovers one of your passwords, they will not automatically have access to all your accounts.
  • Use a password manager: If you struggle to remember all your passwords, consider using a password manager. There are many that can generate and store your passwords securely.
  • Opt for two-factor authentication: In addition to your password, you can use 2-factor authentication (2FA), like a code sent via SMS or a mobile app. Many WordPress plugins offer this feature.
  • Limit login attempts: Limiting the number of unsuccessful login attempts can help counteract brute force attacks. After a certain number of failed attempts, the user will be blocked.

Tip No.4: Camouflage your WordPress login URL

Think of it as a game of hide-and-seek with cybercriminals. If you continue to use the default login URL (“/wp-admin”), you’re telling hackers exactly where to look.

By changing it, you will make their task much more complicated. So, how do you change your login URL?

  • Several WordPress plugins can help you do this in just a few clicks. Two of the most popular plugins are WPS Hide Login and iThemes Security.
  • Once you’ve installed the plugin of your choice, go to the plugin settings and follow the instructions to change the login URL.
  • Don’t forget to save the new URL somewhere safe! It would be unfortunate to be locked out of your own site.
wordpress media 1

Tip No.5: Secure your WordPress website at source with a trusted host

Imagine that your WordPress site is a house. The host is the neighborhood in which you decide to build this house. To ensure the security of your house, you’d want to be in a safe neighborhood, wouldn’t you? The same principle applies to web hosting.

You therefore need to choose a host that provides the following services:

  • Regular updates: Make sure your host regularly updates its servers with the latest operating systems and security software. It’s like checking that the streets are regularly patrolled.
  • Intrusion detection: Your host should have an intrusion detection system in place, just like a safe neighborhood would have constant surveillance.
  • Firewall and antivirus: Your host should have a firewall and an antivirus for its servers. It’s like having a barrier and an alarm system for your house.
  • Automatic website backups: In case of problems, you want to be able to recover your site quickly. A good host will perform an automatic backup of your site or blog regularly.
  • Account isolation: If you share a server with other websites (shared hosting), each account should be isolated from the others. Otherwise, an infection on one site could spread to all the other websites on the server, just as a disease spreads in a community.

Remember, the security of your site starts with choosing a trusted host. As always, caution is the mother of safety!

Tip No.6: Stay up-to-date with PHP

Think of PHP as the operating system of your blog/site. Just as you would with your computer or smartphone, it’s important to keep this system up-to-date for:

  • Security: Each PHP version is generally supported for two years after its release. During this time, it receives regular updates to fix bugs and vulnerabilities. After this period, it is no longer supported and no longer receives updates, leaving your site exposed to risks.
  • Performance: New versions of PHP generally offer better performance than the old ones. In other words, using an obsolete version can slow down your site/blog.

So, you might be wondering: How do I update my version of PHP? For many hosts, you can do this by going to the admin panel (such as cPanel) and clicking on “Select PHP”.

In summary, don’t let your WordPress site run on an outdated version of PHP. Make sure you always use the latest version to keep your site safe, fast and at the top of its performance.

Tip No.7: Use HTTPS and gain the trust of your visitors

Using HTTPS instead of HTTP for your WordPress site/blog is a bit like sending letters in a sealed envelope instead of on open postcards.

Everything sent via HTTPS is encrypted. This means that even if someone manages to intercept the information, they wouldn’t be able to read it.

So you have every reason to switch to HTTPS to:

  • Reassure your visitors: The small green padlock you see in the address bar when you visit an HTTPS site tells your visitors that their data is secure. It’s a sign of trust.
  • Boost your SEO: Google loves secure websites. They even announced that using HTTPS is a positive ranking factor.
  • Take advantage of the speed of the HTTP/2 protocol: HTTPS websites can use the HTTP/2 protocol, which is much faster than its predecessor HTTP/1.1. This can improve the performance of your site.
  • Protect your data: HTTPS encrypts all the information exchanged between the browser and the server, which prevents hackers from intercepting your data.

To activate HTTPS, you will need an SSL certificate. Some hosts offer a free SSL certificate with their hosting plans.

Otherwise, you can obtain one from a recognized Certification Authority.

Tip No.8: Play hide-and-seek with your WordPress version

You may not know that your WordPress version can be visible to all, especially to hackers. It’s like leaving the key under the doormat of your front door.

Yes, knowing your version can give hackers clues about the potential vulnerabilities of your site, especially if you’re using an outdated version.

Are you unsure about your WordPress version? To check, it’s very simple. By default, the WordPress version appears in the source code of your site.

To verify it, right-click on any page of your site, select “Inspect Element” and look for “generator” in the “Elements” tab.

Once identified, all you need to do is add code to your theme to remove this number. But be careful, manipulating code can be tricky if you don’t have experience. If you’re unsure, ask a developer for help or use a plugin like Perf Matters that can do it for you in one click.

By hiding your WordPress version, you make the task of cybercriminals a bit more difficult. It’s a small step for you, but a big one for your site’s security.

wordpress stettings 1

Tip No.9: Block access to sensitive folders

Don’t let hackers get behind the scenes of your site. By default, anyone who knows where to look can access the folders on your WordPress site. Fortunately, there are several ways to boost the security of your folders. Ready to put up a shield around your precious folders? Follow the guide!

  • Modifications via .htaccess: The .htaccess file controls how your site interacts with web servers. By adding a few lines to this htaccess file, you can block access to certain folders. Here are two simple examples:
    • deny from all” denies access to an entire folder.
    • Options -Indexes” disables indexing of htaccess file folders to prevent browsing in them.
  • Protection plugins: If you’re not comfortable with handling code, don’t panic! A plugin like “Hide My WordPress” can make these modifications for you.

Keeping your folders secret is only half the battle. You also need to ensure that files and folders have the correct permission levels:

  • File permissions: As a rule, all your files should have 644 or 640 permissions. This means that you can read and write these files, whereas other users can only read them.
  • Folder permissions: Folders generally need to have 755 or 750 permissions. This allows you to read, write, and run scripts in these folders, whereas other users can only read and execute.
  • Exceptions: The wp-config.php file is an exception. To prevent malicious users from accessing it, you should set its permissions to 440 or 400.

Confused by all these numbers? Don’t worry! A plugin like iThemes Security can analyze your permissions for you.

Tip No.10: Protect your WordPress website against DDoS attacks

DDoS attacks are a bit like a huge crowd rushing to your website’s door, preventing it from functioning properly. These attacks can be devastating, but luckily, there are ways to protect yourself.

Indeed, third-party security services like Cloudflare or Sucuri offer specific protections against DDoS attacks. They place your site behind a proxy, which masks your original IP address. This creates an additional layer of protection for your site, although it does not make it completely invulnerable.

wp cloudflare 1

In the end, protecting against a DDoS attack is like preparing for a storm: it’s better to be overprepared than underprepared.

By using available services and plugins, you can help ensure that your site remains available and functional, even in the face of a DDoS attack.

Bonus tip: Change the Database prefix

By default, the file names that make up your WordPress database begin with “wp_“. Hackers can take advantage of this default setting to locate your database files by their name, which can potentially lead to SQL injections and security vulnerabilities.

Fortunately, there’s a simple solution to mitigate this risk by changing the prefix to something different. While installing the WordPress CMS, you can specify a custom prefix such as “wpdb_” or “wptable_” instead of the default “wp_“.

If your WordPress site is already online and uses the default prefix, you can still change it by renaming the concerned files. It’s strongly recommended to use a plugin specifically designed to handle this process because incorrect configuration could damage your website. Look for a security plugin that offers the option to change table prefixes among its features.

Changing the prefix of your database file adds an extra layer of security to your WordPress site by making it more difficult for hackers to target your database files through known file naming conventions.

Changing the table prefix:

  1. Access your hPanel dashboard and navigate to the file manager or use an FTP client to access the wp-config.php file.
  2. Locate the $table_prefix value in the code and replace the default “wp_” prefix with a unique combination of letters and numbers.
hpane table
  1. Save changes made to the wp-config.php file.
  2. Go back to the hPanel dashboard, go to the Database section and click on phpMyAdmin.
  3. Open your site’s database by clicking “Enter phpMyAdmin”. If you have multiple databases, find your database’s name in the wp-config.php file.
  4. Scroll down and click on the “Select All” button
  5. In the “With selected:” dropdown menu, choose “Replace table prefix“.
  6. Enter the current prefix with the new one that you defined in the wp-config.php file.
  7. Click on “Continue” to replace table prefixes.

Updating prefix values in tables:

Depending on how many plugins you have installed on your site, you may need to manually update some values in certain tables. You can run separate SQL queries on tables that are likely to contain values with the “wp_” prefix, such as the options and user metadata tables.

  1. Access phpMyAdmin and navigate to a table with the prefix value you wish to update (e.g., wp_1secure1_usermeta).
  2. Go to the SQL tab in the upper menu bar.
sql command
  1. Enter the filtering code into the SQL query editor and click on “Go”, modifying the table name and field names according to your specification.
capture decran 2023 07 14 a 15.04.18
  1. The filtered results will appear. Click on the “Edit” button next to the targeted field.
  2. Change the prefix value and click on “Go”. Repeat steps 4 and 5 for all filtered values.
  3. Repeat steps 1 to 7 for other database tables to update all values with the “wp_” prefix.

WordPress security: the key points to remember

In sum, as you have understood, the security of your WordPress site is not to be taken lightly; it requires awareness of potential vulnerabilities, implementation of preventive measures, and the use of appropriate tools.

From choosing a secure host to using protection plugins to regularly backing up your files, every step counts towards reinforcing the security of your site.

To keep cybercriminals at bay, it’s essential to always keep your WordPress and its components up-to-date, use strong and unique passwords, and hide sensitive information.