Local database settings

Posted on May 11, 2021

This plugin has multiple IP address geolocation databases distributed by Maxmind and IP2location. Utilizing multiple data sources is an important mechanism that can complement each other when data is missing. These databases are managed by the Geolocation API library named IP Geo API which which has been separately developed as an another project.

Geolocation API Library

IP Geo API can be installed with the geolocation databases in one of the following directories:

  1. /wp-content/ip-geo-api/
  2. /wp-content/uploads/ip-geo-api/
  3. /wp-content/plugins/ip-location-block/ip-geo-api/

The actual storage location depends on the permission setting of the WordPress tree. If you find it’s 3. then it is necessary to adjust the permissions so that it becomes 1 or 2. to prevent the geolocation databases being removed on updating this plugin.

Local database settings

In some cases, you might see the following error message right after your first installation. This would be caused by a permission touble due to your server’s security configurations.

Error of IP Geo API

In this case, you have to install IP Geo API by your own hand and once deactivate this plugin then activate it again. Please find how to do it in the codex “How can I fix permission troubles?”.

Type of geolocation database

In the location information database downloaded by default, only the IP address and the corresponding country code are stored. But when you switch the type of database to another, you will be able to get the city name, coodinates of longitude and latitude.

Please refer to ip-location-block-maxmind-zip-ipv4 and ip-location-block-maxmind-zip-ipv6 to know how to change the source of databases.

CloudFlare & CloudFront API library

If you are using a reverse proxy or load balancing service provided by CloudFlare or CloudFront, you can obtain the country code of the access source through special environment variables.

To use this, it is necessary to install a dedicated API library. Please refer to CloudFlare & CloudFront API class library.