ip-location-block-dns

Posted on May 11, 2021

Specify the domain name server for reverse DNS lookup.

Description

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

Parameters

  • $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( '1.1.1.1', '1.0.0.1' ); // APNIC  public DNS (faster)
//  return array( '8.8.8.8', '8.8.4.4' ); // 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.

Since

0.3.0.14