PHPCheck.net

Harden WordPress: the most important measures against hacks

WordPress itself is well maintained – most successful attacks go through outdated plugins, weak passwords or an insecure server environment. These measures close the most important entry points.

1. Updates – automatic where possible

2. Protect the login

3. Harden wp-config.php

define('DISALLOW_FILE_EDIT', true);   // no file editor in the dashboard
define('WP_DEBUG', false);            // no error messages on the front end
define('FORCE_SSL_ADMIN', true);      // dashboard via HTTPS only

The file should not be readable by other users (permissions e.g. 640 or 600) and should contain its own random security keys.

4. Don't reveal versions

The meta generator in the page source and the ?ver= parameters reveal WordPress and plugin versions. Remove the generator in the functions.php of your (child) theme:

remove_action('wp_head', 'wp_generator');

This does not replace updates, but it makes automated searches for vulnerable sites harder. See also disable expose_php.

5. Files and uploads

6. Backups and monitoring

Sources

More guides