You can block malicious IP addresses in WordPress using several effective methods:
-
Manually Block IPs via WordPress Dashboard
Navigate to Settings → Discussion in your WordPress admin panel. Scroll to the “Disallowed Comment Keys” or “Comment Blacklist” section and paste the suspicious IP addresses. This prevents those IPs from posting comments but does not block site access entirely. -
Block IPs Using cPanel’s IP Blocker
Log in to your hosting account’s cPanel, go to the Security section, and select IP Blocker. Enter the IP address or IP range you want to block and add it. This method blocks the IPs from accessing your entire website at the server level, providing stronger protection against malicious traffic. -
Use Security Plugins
Install a security plugin like All-In-One Security (AIOS) that automatically detects and blocks suspicious IP addresses. These plugins often include firewalls and other tools to protect your site from malware and attacks without manual IP management. -
Block IPs via .htaccess File
Edit your WordPress site’s .htaccess file (located in the root directory) to deny access to specific IPs. For example, to block a single IP, add:<Limit GET POST> order allow,deny deny from 123.45.67.89 allow from all </Limit>
To block multiple IPs or ranges, add multiple
deny from
lines or specify partial IPs to block ranges. This method blocks access at the web server level and is very effective but requires careful editing and backups to avoid site issues.
Summary Table
Method | Scope of Blocking | Ease of Use | Notes |
---|---|---|---|
WordPress Discussion Settings | Blocks commenting only | Easy | Does not block site access |
cPanel IP Blocker | Blocks entire site access | Moderate | Server-level blocking |
Security Plugins | Automated detection & blocking | Easy | Requires plugin installation |
.htaccess File Editing | Blocks entire site access | Advanced | Powerful but requires careful handling |
Each method serves different needs: for comment spam, use WordPress settings; for full site blocking, use cPanel or .htaccess; for automated protection, use security plugins. Always back up your site and files before making changes, especially when editing .htaccess or server settings.
PH Ranking offers the highest quality website traffic services in Philippines. We provide a variety of traffic services for our clients, including website traffic, desktop traffic, mobile traffic, Google traffic, search traffic, eCommerce traffic, YouTube traffic, and TikTok traffic. Our website boasts a 100% customer satisfaction rate, so you can confidently purchase large amounts of SEO traffic online. For just 720 PHP per month, you can immediately increase website traffic, improve SEO performance, and boost sales!
Having trouble choosing a traffic package? Contact us, and our staff will assist you.
Free consultation