Security Optimization
WordPress Security Optimization
Intermediate — comfortable administering WordPress.
Advanced — server-admin or developer experience recommended.
Medium — noticeable improvement.
High — potentially major reduction in attack-related server load.
1. Shutdown Unnecessary Server Services
Every unused service consumes resources and can create another network entry point for spam, scanning, or attacks. Disable services that are not required by the WordPress workload.
- DNS — disable the local DNS service when authoritative DNS is handled externally.
- Email — disable local mail services when a third-party email provider handles mail delivery.
- FTP/SFTP — disable file-transfer services that are not used.
- Unused proxy/cache services — remove or stop components such as Varnish when they are not part of the active architecture.
2. Configure the Server Firewall
Default firewall rules are often deliberately permissive to avoid breaking applications. Tighten access based on how each service is actually used.
- Administrator-only ports — restrict SSH, FTP, or similar services to trusted IP addresses whenever practical.
- Region-specific services — if a service is only used from one country or region, geographic restrictions may reduce unwanted traffic.
- Known abusive networks — block repeatedly malicious IP ranges where justified by logs and operational requirements.
3. Enable Server Brute-Force Protection
Brute-force protection behaves like an adaptive firewall. Services remain available, but obvious offenders can be automatically blocked after repeated failed authentication attempts or other suspicious patterns.
- Enable the brute-force or DDoS protection supplied by the server stack where appropriate.
- Start with moderate thresholds rather than highly aggressive blocking.
- Review logs and false positives after enabling automated bans.
- Busy shared servers with many legitimate users require more conservative settings.
4. Brute-Force Protection on wp-login.php
The WordPress login endpoint is a frequent target for automated username/password attacks. Even unsuccessful login attempts can consume PHP and database resources.
5. Use HTTP Authentication
HTTP authentication adds a web-server-level username and password prompt before requests reach the protected WordPress page or directory.
- Useful for heavily attacked administration pages.
- Can protect
wp-adminor other sensitive paths. - Stops unwanted traffic before WordPress/PHP processing begins.
- Adds an extra login step for legitimate users, so use it only where the trade-off is acceptable.
6. Disable XML-RPC When Unused
WordPress XML-RPC allows external applications and services to interact remotely with WordPress. Because the endpoint is also frequently targeted by automated attacks, disable it when no active integration requires it.
- Disable XML-RPC completely if mobile apps, Jetpack, remote publishing, or other integrations do not depend on it.
- If XML-RPC must remain enabled, restrict access to known trusted sources where practical.
- Monitor requests to
xmlrpc.phpif the server experiences unexplained PHP load.
7. Configure Security Plugins Carefully
Security plugins are useful when server-level access is limited or when individual WordPress installations require different policies. However, PHP-level inspection uses application resources for every request.
- Use malware scanning to detect compromised files and applications.
- Schedule intensive scans during lower-traffic periods.
- Do not duplicate a strong server firewall with an equally aggressive PHP-level firewall unless there is a clear reason.
- Avoid excessive real-time scanning or filtering that creates more load than the attacks it is intended to stop.
- Use slower scan modes or less frequent schedules on large websites when appropriate.
8. DNS Edge-Level Security Configuration
Security filtering can also happen before traffic reaches the hosting environment by using a DNS proxy, CDN, or external security provider.
Most routine attacks can be handled by normal server and application protections. Specialized external mitigation becomes particularly useful when the origin server is being overwhelmed by a serious targeted attack or when the administrator does not have the resources to manage the protection locally.
9. HTTPS and HTTPS Redirect
Use HTTPS across the entire WordPress website and enforce the preferred HTTPS domain version with permanent redirects.
- Install a valid SSL/TLS certificate for the website.
- Redirect HTTP traffic to HTTPS at the web-server or edge-proxy level.
- Redirect visitors to one canonical domain version, such as either
wwwor non-www. - Update internal WordPress links so they already use HTTPS.
- Avoid relying on WordPress/PHP to perform redirects when the web server can do the job earlier in the request path.
