Your Dedicated Partner for All Things WordPress

How to Block IP Addresses in WordPress

Table of Contents

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 allow from all </Limit> Replace ‘’ with the IP address you want to block and save changes once done.

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.


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!


How to get started?

Learn more

WordPress Maintenance

Save 33% with our Annual pricing plan.

Get Started

Looking for help? Chat with us.

Are you in need of assistance or guidance? Look no further! Our dedicated team is here and ready to help. Chat with us today and let’s work together to find the perfect solution for your needs.

Our support team will get you:

I believe every website owner deserves a reliable professional support always by their side.

Alexey Seryapin
Founder of WPServices

Having Troubles With WordPress?

Claim Your Free WordPress Maintenance

In today’s fast-paced digital landscape, every website deserves the care and expertise of a professional maintenance team, ensuring optimal performance, enhanced security, and seamless user experiences, so you can focus on growing your business with peace of mind.

Alexey Seryapin
Founder of WPServices

Coupon Code Applied!

Take your time and continue browsing our services.

Alexey Seryapin
Founder of WPServices