# How to secure a WordPress website

> Practical ways to secure a WordPress website, with configuration examples and access restrictions for sensitive files.

- Canonical page: https://exito.bg/en/blog/wordpress-security/
- Language: en
- Български: https://exito.bg/blog/wordpress/how-protect-wordpress/
- Source: Studio EXITO.

[All posts](https://exito.bg/en/blog/)

WordPress12 May 2023

Studio EXITO

![How to secure a WordPress website](https://exito.bg/assets/images/blog/wordpress-protect-banner-02093b76.webp)

Among the most essential things for your online business is to learn **how to secure your wordpress site** from the so-called hacker attacks. Always accept [the security of your site](https://exito.bg/en/services/support/website-maintenance/) seriously, because the consequences can be disastrous for your business.

 

We're going to walk you through a few basic steps we can take to secure our WordPress site. Let's get started.

 

## Secure and reliable hosting company

 

There is no dispute that **the reliability of the hosting provider is of paramount importance**, so we can protect our WordPress site. That is why we recommend you to take advantage of [The super services of Superhosting BG.](https://www.superhosting.bg/?utm_source=exito.bg) Why do we choose them and not any of the other companies on the market? This is another topic that we will answer another time. Now to the point.

 

It is important that the hosting provider offers **Security, Protection, SPAM filters, Server speed, 24/7 service** – all this is guaranteed by them.

 

## Disable file editing on the system

 

Through WordPress administration, anyone with access can edit system files and extensions from your WordPress installation. **Disable editing of files**, so we can protect our WordPress site. Open the file `wp-config.php` Scroll to the very end and add the following command:

 

```
define('DISALLOW_FILE_EDIT', true);
```

 

Directly **before the next part** from the file:

 

```
/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';
```

 

## Use an SSL certificate

 

In order to protect our WordPress site as much as possible, we must **to have a certificate installed** to the domain. Connection security is also a must from the browsers point of view. Especially if [you maintain an Online Store](https://exito.bg/en/services/support/ecommerce-maintenance/)…

 

## Remove the version of your WordPress site

 

As you know, WordPress declares the version you use on your site. If you go to the home page of your site and press the keyboard keys `Ctrl+U` a new tab containing the page code will open. The page code contains information about your WordPress version, for example:

 

```
<meta name="generator" content="WordPress 5.5.1"/>
```

 

The funny thing is that the example above is from a competing web design studio that even offers "maintenance and protection of WordPress sites from hackers"! Anyway… In this case, to protect your WordPress site information, we have two options.

 

### Option 1 – Plugin (Not Recommended)

 

### Option 2 – A bit of code

 

Since it is important for us to protect our WordPress site and at the same time not overload it with WordPress Plugins, we will do it by adding 5 lines of code in `function.php` file in your child directory. Add the following code:

 

```
// Remove version info from head and feeds
function complete_version_removal() {
    return '';
}
add_filter('the_generator', 'complete_version_removal');
```

 

Now you can repeat the steps with `Ctrl+U` and search. No one can now find out the version of your WordPress installation through the code.

 

## Change your Authentication Unique Keys and Salts periodically

 

WordPress security keys are a set of random variables that improve the encryption of information stored in a user's cookies. There are a total of four security keys: `AUTH_KEY, SECURE_AUTH_KEY, LOGGED_IN_KEY и NONCE_KEY`

 

These security keys make it harder to crack your password. An unencrypted password like "username" or "wordpress" can be easily cracked, but a random, unpredictable, encrypted password like "88a7da62429ba6ad3cb3c76a09641fc" takes ages to find the right combination. You need to use the keys so we can secure your WordPress site.

 

For the purpose again **no need to add redundant extensions** (Plugins), and we can simply generate new and quite complex ones, through a WordPress generator that was created by the developers of the system.

 

[https://api.wordpress.org/secret-key/1.1/salt/](https://api.wordpress.org/secret-key/1.1/salt/?utm_source=exito.bg) – on each refresh, generates strings of different characters that you can use. The generated keys are added to the file `wp-config.php`

 

## Set strong login passwords

 

In order to protect WordPress as much as possible, we must not compromise our passwords. Passwords like "admin1234" **are inadmissible!**Your password must be at least 8 characters long and must contain letters, symbols and numbers. Through this password generator, we can protect our WordPress password perfectly.

 

[https://passwordsgenerator.net](https://passwordsgenerator.net/?utm_source=exito.bg)

 

## Protect the login page

 

The page through which you enter the Administration of your WordPress site is`/wp-login.php`It must be protected to avoid Brute Force Attack. The easiest and quite good way to protect the WordPress administration is to block access to this page except for your IP address. How can this be done?… Of course with a little code addition, but this time in the file`.htaccess`

 

```
<Files wp-login.php>
	Order Deny,Allow
	Deny from all
	Allow from 123.456.789 - Заместете с вашия IP адрес
</Files>
```

 

## Do you need help?

 

If you need help or better protection of your WordPress site, don't hesitate to contact us.  
Web: [https://exito.bg/](https://exito.bg/)  
Email: [office@exito.bg](mailto:office@exito.bg)  
Viber: Studio EXITO  
Phone: [+359 887 353 247](tel:+359887353247)
