Home • Blog • Article

How to Block IP Addresses in WordPress

By Fathima Nourin TM • •
, ,

WordPress is a popular platform, and with its popularity comes the risk of malicious activity. If you own a website on WordPress, it’s important to know how to protect yourself from threats like spam comments, brute force attacks, and other malicious activities. Blocking IP addresses is one of the best ways to protect your website, so let’s take a look at how to block IP addresses in WordPress.

How to Block an IP Address Manually

One of the simplest ways to block an IP address in WordPress is by manually adding it to your .htaccess file. This file can be accessed by logging into your cPanel, then navigating to File Manager > public_html > wp-admin. Once you’re there, open up the .htaccess file and add the following code: <Limit GET POST> order allow,deny deny from xxx.xxx.xxx.xxx allow from all </Limit> Replace ‘xxx.xxx.xxx.xxx’ with the IP address you want to block and save changes once done.

🚨 Facing an active site error or malware warning?

Chat with an engineer on WhatsApp within 15 minutes.

💬 Chat on WhatsApp

How To Use Plugins To Block An IP Address

If you don’t feel comfortable editing files manually or don’t have access to cPanel, then using a plugin might be a better option for you. There are several plugins available that can help you easily block an IP address from accessing your website such as WP Security Guard Pro or WP Cerber Security & Antispam Plugin (free). All you need to do is install and activate the plugin then go through its settings page to add the specific IP address that you want to block from accessing your website.

Conclusion

Blocking an IP address can be a great way of protecting your website from malicious activities like spam comments or brute force attacks. We hope this article has helped you understand how easy it is for anyone to block an IP address in WordPress – either manually or with the help of plugins – so that they can keep their websites safe and secure! If you have any questions about blocking an IP address in WordPress feel free contact us at Metric Marketing today! We’re here and happy help answer any questions or concerns related to digital marketing that our readers may have!

Professional WordPress Support & Care

Maintaining a high-performing, secure WordPress site requires continuous monitoring and proactive updates. At SiteSuraksha, our dedicated technical team provides 24/7 security hardening, speed optimization, and hands-on maintenance so you can focus on growing your business.

Follow SiteSuraksha on Google
Add us to your preferred sources for verified WordPress & hosting guides.
FREE 30-SECOND DIAGNOSTIC

Is Your Website Fast & Secure?

Run an instant scan for security vulnerabilities, bloated plugins, and TTFB latency.

🔍 Test Your Site Now →
Map Your Issue to Guaranteed IT Care
Security & Malware
Hacks, 0-day exploits & backup failures
Pro Care (₹5,420/mo) →
Speed & Cloud Bills
Slow checkout, high TTFB & cloud waste
Pro Care (₹5,420/mo) →
ERP & Automation
GST pipelines, RPA & AI support agents
Enterprise (₹14,999/mo) →
EXPERT WORDPRESS CARE

Need Help Securing or Speeding Up Your Site?

Get 24/7 proactive security WAF, daily cloud backups, and sub-second speed optimization from ₹3,470/mo.

💬 Chat on WhatsApp Explore Plans
← Back to All Articles