May 11, 2021
Darko G.

The directory where IP address geolocation APIs are installed.


The filter hook “ip-location-block-api-dir” assigns the absolute path to the directory where the class libraries of IP address geolocation APIs for MaxMind and IP2Location are installed. The directory is also used as a storage of IP geolocation databases.

The class libraries can be available from WordPress-IP-Geo-API.


  • $dir
    (string) /absolute/path/to/wp-content/

Use case

If you want change it to your /wp-content/uploads/ directory, put the following code snippet into the functions.php in your theme.

function my_api_dir( $dir ) {
    $upload = wp_upload_dir();
    return $upload['basedir'];
add_filter( 'ip-location-block-api-dir', 'my_api_dir' );

You should download WordPress-IP-Geo-API and upload ip-geo-api to /absolute/path/to/wp-content/uploads/ with write permission.

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