May 11, 2021
Darko G.

Specify the domain name server for reverse DNS lookup.


The filter hook “ip-location-block-dns” can replace the reverse DNS lookup service on your server if it is slow.


  • $resolvers
    (array) An array of DNS lookup resolvers that can be primary and secondary name servers.

Use case

The following code snippet in your theme’s functions.php can use APNIC public DNS resolver or Google public DNS resolver.

function my_gethostbyaddr( $resolvers ) {
    return array( '', '' ); // APNIC  public DNS (faster)
//  return array( '', '' ); // Google public DNS (slower)
add_filter( 'ip-location-block-dns', 'my_gethostbyaddr' );
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