The directory where the backup files of validation logs are saved.


The filter hook “ip-geo-block-backup-dir” assigns the absolute path to the directory where the backup files of validation logs are saved.

The maximum entries of each validation log for the target (e.g. comment, xmlrpc, login, admin and public) is limited to 100. So if you want to save backups, use this hook.


Use case

The following code snippet in your theme’s functions.php selectively saves the CSV formatted text files which will be named as ip-geo-block-YYYY-MM.log.

function my_backup_dir( $dir, $hook ) {
    if ( 'login' === $hook )
        return '/absolute/path/to/';
        return null; // do not keep backups
add_filter( 'ip-geo-block-backup-dir', 'my_backup_dir', 10, 2 );
WARNING: The '/absolute/path/to/' should be outside of your public area.
NOTE: When you select "mu-plugins" (ip-geo-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.

The CSV format is as follows:

Entry Description
time requested time in seconds
ip address ip address of requester
target requested target e.g. comment, xmlrpc, login, admin
authority logged in user or not
country country code
result validation result e.g. blocked, wp-zep, failed, badsig
method HTTP method and port e.g. GET, POST
UA user agent strings
headers HTTP headers
queries requested queries