Client area

Licenses, downloads and support tickets.

Documentation v2.0.1

Yeasin Geo-Blocker Pro

Developer Tools Pro feature

WP-CLI, Hooks & PHP API

2 min read Updated Nov 26, 2026

Automate Geo-Blocker Pro from the command line or extend it with code.

WP-CLI commands

wp ygb status                         # version, license, database, rules, events today
wp ygb lookup 95.24.0.1 --url=/shop/  # location + full decision trace
wp ygb sync                           # download / update MaxMind City + ASN
wp ygb settings list                  # all settings as JSON
wp ygb settings get countries
wp ygb settings set is_enabled 1
wp ygb settings set countries '["RU","CN","GROUP:SANCTIONED"]'
wp ygb export --file=geo.json         # settings + rules (no secret keys)
wp ygb import geo.json
wp ygb unban 203.0.113.7              # remove rate-limit ban + login lockout
wp ygb clear_logs
wp ygb report                         # send the weekly email now

Settings changed with set or import are validated exactly like in the admin, and page caches are purged.

PHP helpers

if ( function_exists( 'ygb_get_visitor_country' ) ) {
    $country  = ygb_get_visitor_country();   // 'US', 'BD', 'UNKNOWN' or 'LOCAL'
    $location = ygb_get_visitor_location();  // country, continent, state_code, state_name, city, asn, asn_org
}

Filters

Filter

Use

ygb_visitor_ip

Override the detected visitor IP.

ygb_pre_lookup

Return an array to short-circuit the location lookup (e.g. your own GeoIP service).

ygb_location

Modify the location array after lookup.

ygb_country_groups

Add your own country groups (shown in every picker as GROUP:KEY).

ygb_verified_bots

Add crawlers and their reverse-DNS domains.

ygb_is_verified_bot

Final say on bot verification.

ygb_datacenter_isps

Network names treated as VPN/datacenter.

ygb_cloudflare_ranges

Cloudflare IP ranges used for safe header trust.

ygb_db_path / ygb_asn_db_path

Custom location for the MaxMind files.

ygb_log_max_rows

Maximum rows kept in the log table (default 100,000).

Actions

  • ygb_purge_cache – fired when settings change; clear your own caches here.

REST API

The admin uses /wp-json/ygb/v1/* (requires manage_options). Public endpoints: GET /ygb/v1/check (cache-safe mode decision) and POST /ygb/v1/challenge.

Example: add a custom group

add_filter( 'ygb_country_groups', function ( $groups ) {
    $groups['NORDIC'] = array( 'label' => 'Nordic countries', 'countries' => array( 'DK', 'FI', 'IS', 'NO', 'SE' ) );
    return $groups;
} );

Was this guide helpful?

Still stuck?

Open a ticket and the developer will help you set it up — usually within 24 hours.

Get help