May 11, 2021
Darko G.

The URI to MaxMind GeoLite2 geolocation database for IPv4 and IPv6.


The filter hook “ip-location-block-geolite2-zip-ip” assigns the URI to GeoLite2 Free Downloadable Database which can be downloaded by tar format compressed by GZIP.


  • $url
    (string) https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz

Use case

If you’d like to use GeoLite2 City database, put the following code snippet into the functions.php in your theme.

function my_geolite2_zip_ip( $url ) {
    return 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz';
function my_geolite2_path( $file ) {
    return '/absolute/path/to/wp-content/ip-geo-api/maxmind/GeoLite2/GeoLite2-City.mmdb';
add_filter( 'ip-location-block-geolite2-zip-ip', 'my_geolite2_zip_ip' );
add_filter( 'ip-location-block-geolite2-path',   'my_geolite2_path'   );
NOTE: When you select "mu-plugins" (ip-location-block-mu.php) as Validation timing , you should put your code snippet into drop-in.php in Geolocation API folder instead of functions.php. See My custom functions in “functions.php” doesn’t work. in FAQ for detail.


Leave a Reply

Your email address will not be published. Required fields are marked *

© 2024 - IP Location Block by IDEOLOGIX Media