Posted on May 11, 2021

The message of the reason when the blocking occurs.


The filter hook “ip-location-block-xxxxx-reason” where xxxxx is one of comment, xmlrpc, login, admin and public assigns the human readable message according to the “Response code” on “Validation rule settings” when the blocking occurs.


Use case

The following picture shows a human readble message when a blocking occurs.

403 error page

You can change the message “Forbidden” as follows:

function my_comment_reason ( $msg ) {
    return "Sorry, this service is unavailable.";
add_filter( 'ip-location-block-comment-reason',  'my_comment_reason'  );
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.