dev3 ·
My site was hit by spam injection last year. Beyond installing a security plugin, what should I actually configure to harden WordPress?
0
DEV3 Developer Forum
Every post is reviewed first. Usually reviewed within 24 hours.
My site was hit by spam injection last year. Beyond installing a security plugin, what should I actually configure to harden WordPress?
Most compromises come from outdated plugins, weak credentials and writable code. Work through these.
Updates
Accounts
admin, least privilege roles.Configuration in wp-config.php:
define( 'DISALLOW_FILE_EDIT', true ); // removes the theme/plugin code editor
define( 'FORCE_SSL_ADMIN', true );
define( 'WP_DEBUG_DISPLAY', false );
Generate fresh salts at the official salt service and replace the keys; this logs everyone out.
Files
wp-config.php 600 or 640.wp-config.php above the web root if your host allows.location ~* /wp-content/uploads/.*\.php$ { deny all; }
xmlrpc.php if you do not use it, and to .git, .env, *.sql, debug.log.Network
Operations
wp core verify-checksums, wp plugin verify-checksums --all), and log monitoring.If already compromised: restore a clean backup, rotate all passwords, salts, database and API credentials, then patch the entry point or it returns.