ip-location-block-ip2location-path

Posted on May 11, 2021

The absolute path to IP2location database file for IPv4.

Description

The filter hook “ip-location-block-ip2location-path” assigns the absolute path to IP2Location database file for IPv4.

Parameters

  • $path
    (string) /absolute/path/to/wp-content/ip-geo-api/ip2location/IP2LOCATION-LITE-DB1.BIN

Use case

If you’d like to share the database file with other WordPress plugins like IP2Location Tags (or other free plugins), the following code snippet in your theme’s functions.php may help you.

function my_ip2location_path( $path ) {
    return WP_PLUGIN_DIR . '/ip2location-tags/IP2LOCATION-LITE-DB1.BIN';
}
add_filter( 'ip-location-block-ip2location-path', 'my_ip2location_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.

Since

1.2.0