WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Visitor Country

A plugin that retrieves the visitor's country information (using MaxMind's GeoIP local dat file)

This plugin adds support for displaying (using shortcodes) or enquiring (using PHP or JS) the visitor's country. See it working here.

It uses MaxMind's GeoIP data file, which is around 1.4 MB in size and is included with the plugin. The file is free, updated every month, and has the claimed accuracy of 99.5%;

GitHub Repository is here.

The plugin retrieves:

  • The visitor's IP
  • The visitor's country name
  • The visitor's country code (2 letter ISO 3166)

The shortcodes are:

  • [VisitorCountry-IP]
  • [VisitorCountry-Code]
  • [VisitorCountry-Name]

The javascript variables are:

  • VisitorCountry.ip
  • VisitorCountry.code
  • VisitorCountry.name

And the PHP functions:

global $VisitorCountry;
if ( isset($VisitorCountry) )
{
    echo $VisitorCountry->GetIP();    
    echo $VisitorCountry->GetCode();
    echo $VisitorCountry->GetName();        
}

Please leave suggestions, comments and bug report at the plugin's website.

Also, please let it be known if the plugin works on versions older than 3.2 - I simply didn't have a way to check.

This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/app/geolitecountry

Requires: 3.2 or higher
Compatible up to: 3.5.2
Last Updated: 2013-5-27
Downloads: 4,075

Ratings

5 stars
5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

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

100,1,1
100,2,2 100,1,1
100,1,1 100,1,1