Ready to get started?Download WordPress

Plugin Directory

IP Geo Block

A WordPress plugin that blocks any comments posted from outside your nation.

What is this plugin for?

It's for blocking spam comments. If you can not specify countries with white list or black list to protect your site against spam comments, you should choose other awesome plugins.

How can I check this plugin works?

Check statistics tab on this plugin's option page.

How can I test on the local site?

There are two ways. One is to add some code somewhere in your php (typically


in your theme) to substitute local IP address through filter fook ip-geo-block-addr as follows:

function substitute_my_ip( $ip ) {
    return ''; // yahoo.com
add_filter( 'ip-geo-block-addr', 'substitute_my_ip' );

And another is adding RD as a country code into White list or Black list. Most of the IP Geolocation services return empty (with some status) if a local IP address (e.g. is sent, but only freegeoip.net returns RD.

Can I add an additional spam validation function into this plugin?

Yes, you can use add_filter() with filter hook ip-geo-block-validate in somewhere (typically functions.php in your theme) as follows:

function your_validation( $commentdata ) {
    // your validation code here

    if ( ... /* if your validation fails */ ) {
        // tell the plugin this comment should be blocked!!
        $commentdata['ip-geo-block']['result'] = 'blocked';

    return $commentdata;
add_filter( 'ip-geo-block-validate', 'your_validation' );

Then you can find ZZ as a country code in the list of Blocked by countries on the statistics tab of this plugin's option page.

Requires: 3.5 or higher
Compatible up to: 3.8.3
Last Updated: 2014-2-2
Downloads: 254


0 stars
0 out of 5 stars


Got something to say? Need help?


Not enough data

0 people say it works.
0 people say it's broken.