Plugin converts IP-address to the country.

Author:webvitaly (profile at wordpress.org)
WordPress version required:3.0
WordPress version tested:5.4.2
Plugin version:1.3
Added to WordPress repository:09-07-2011
Last updated:09-08-2020
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:0
Rated by:0
Plugin URI:http://wordpress.org/plugins/ip2country/
Total downloads:3 675
Active installs:10+
plugin download
Click to start download

Get country code or country name:

$ip2country = ip2country();
echo ' Country code: '.$ip2country->country_code;
echo ' Country name: '.$ip2country->country_name;
// or
$ip2country2 = ip2country('');
echo ' Country code: '.$ip2country2->country_code;
echo ' Country name: '.$ip2country2->country_name;

Get additional info about the country by country code:

$ip2country_info = ip2country_info($ip2country->country_code);
echo ' iso_code_2: '.$ip2country_info->iso_code_2;
echo ' iso_code_3: '.$ip2country_info->iso_code_3;
echo ' iso_country: '.$ip2country_info->iso_country;
echo ' country: '.$ip2country_info->country;
echo ' lat: '.$ip2country_info->lat;
echo ' lon: '.$ip2country_info->lon;
// or
$ip2country_info = ip2country_info('us');
echo ' lat: '.$ip2country_info->lat;
echo ' lon: '.$ip2country_info->lon;

Ip2country support page