Advanced Country Blocker

설명

Advanced Country Blocker helps you secure your WordPress site by restricting access based on the visitor’s geolocation (country) or IP address. Upon activation, the plugin detects the activating admin’s country and automatically sets that as the only allowed country. All other visitors from different countries are blocked, unless they use a secret key parameter to temporarily whitelist their IP.

Key Features:

  • Automatically allows the admin’s country on plugin activation.
  • Temporary access via a customizable secret URL parameter (e.g., ?MySecretKey=1).
  • Manual blacklisting of specific countries or IP addresses for added security.
  • Optional email alerts when new visitors are blocked.
  • Admin bypass so logged-in admins can always access the site (toggleable in the code).
  • Detailed logging of blocked attempts in a custom database table, displayed in the WP admin.
  • Custom “Blocked” page functionality—show a custom message or redirect to a specific page instead of the default 403.

Use the plugin settings page (Country Blocker menu in WP admin) to configure the list of allowed countries, blacklisted countries, blacklisted IPs, and whether email alerts are enabled.

License

This plugin is open-sourced software licensed under the GPLv3 or later.

External Services

This plugin uses the free IP geolocation service provided by IP-API to determine the visitor’s country.
Data sent to IP-API includes:
– Visitor’s IP address (to determine the country of origin).

Learn more about their:
Terms of Service
Privacy Policy

스크린샷

  • Settings Page – Configure allowed/blacklisted countries, IPs, and email alerts.
  • Blocked Attempts Log – View a list of recently blocked visitors.

설치

  1. Upload the plugin folder to the /wp-content/plugins/ directory, or install via the WordPress “Add Plugin” feature.
  2. Activate the plugin through the “Plugins” menu in WordPress.
  3. Upon activation, the plugin will:
    • Detect the activating admin’s IP.
    • Determine the corresponding country via the IP geolocation API.
    • Set that country as the only allowed country in the plugin settings.
  4. Go to Country Blocker Settings in your WordPress admin menu to adjust configurations (e.g., secret key, blacklisted countries, blacklisted IPs, etc.).

FAQ

My IP geolocation is incorrect. How do I fix it?

Most IP geolocation services have occasional inaccuracies. You can manually add or remove countries on the settings page to adjust who is allowed or blocked.

What if I accidentally block myself?

You can add your IP manually to the temporary whitelist by using the URL parameter (?YourSecretKey=1), or log in as an admin (if admin bypass is enabled). Alternatively, you can deactivate the plugin via FTP or your hosting control panel and adjust settings.

Does this plugin store any visitor data?

The plugin stores IP addresses and (optionally) country codes in a custom log table when visitors are blocked. This is purely for security and administrative review. Remove or adjust this functionality as needed to comply with privacy regulations.

Can I bypass the plugin if I’m an administrator?

Yes, by default, if you are logged in with manage_options capability. You can change or remove this bypass in the plugin code.

후기

2025년 3월 14일
So far beyond simple. I only wanted the US to access my website because its the only place I ship to and I get a ton of attacks from other countries. Within minutes my logs showed 3 other countries had already been blocked. I also have WordFence so I can see incoming traffic so it will be neat to see if this blocks the bulk of other countries. With high hopes I thank you for making this plugin!
2025년 2월 24일 답글 1개
The improvements in 2.0.2 are nice and for me seem more functional. If you are still open to suggestions, I think it would be helpful to sort the allowed or blocked countries alphabetically when you load the plugin. Once you add a dozen or so following your list becomes a little difficult. Just a suggestion and not a must have. Thanks for being so responsive.
2025년 2월 17일
It’s a simple plugin that simply works. Also, I made it, so ofc 5 stars. =D
모든 3 평가 읽기

기여자 & 개발자

“Advanced Country Blocker”(은)는 오픈 소스 소프트웨어입니다. 다음의 사람들이 이 플러그인에 기여하였습니다.

기여자

자국어로 “Advanced Country Blocker”(을)를 번역하세요.

개발에 관심이 있으십니까?

코드 탐색하기는, SVN 저장소를 확인하시거나, 개발 기록RSS로 구독하세요.

변경이력

2.0.3

  • Added feature to Clear Logs
  • Added feature to Disable Logs
  • Fixed pagination for Logs

2.0.2

  • Added the blacklist mode

2.0.1

  • Fixed WordPress Repo guideline issues

2.0.0

  • Added logging to a custom database table.
  • Added blacklisted country/IP feature.
  • Added admin bypass for testing.
  • Added email alerts.

1.1.0

  • Defaulted to admin’s country on plugin activation.
  • Introduced secret URL key for temporary IP whitelisting.

1.0.0

  • Initial plugin release with basic country blocking and default country code.