| 开发者 | awesoft |
|---|---|
| 更新时间 | 2026年10月11日 16:49 |
| 捐献地址: | 去捐款 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
/wp-admin and /wp-login.php without touching the public site.
Features
/wp-admin and /wp-login.php; the login protection can be switched off separately.203.0.113.0/24 or 2001:db8::/32.# on each line so you can label entries.X-Forwarded-For, X-Real-IP or CF-Connecting-IP header when the site runs behind a proxy, load balancer or Cloudflare. Headers are never trusted unless you select them.admin-ajax.php), cron, WP-CLI, front-end admin-post.php submissions and password-protected post forms are not blocked.AWESOFT_IP_WHITELIST_DISABLE in wp-config.php to switch the whitelist off without database access.awesoft_ip_whitelist_allowed filter for developers who need custom allow rules.awesoft-ip-whitelist folder to /wp-content/plugins/, or install it from the WordPress plugin directory.Add the following line to wp-config.php and the whitelist is bypassed immediately:
define( 'AWESOFT_IP_WHITELIST_DISABLE', true );
Then log in, fix the list, and remove the line again. Alternatively, delete the awesoft_ip_whitelist_enabled option from the wp_options table, or remove the plugin folder over FTP/SSH.
By default the plugin only trusts the connection address (REMOTE_ADDR), which is the proxy's address in that setup. Choose the header your proxy sets under Visitor IP source: CF-Connecting-IP for Cloudflare, X-Forwarded-For for most load balancers, or X-Real-IP for Nginx. Only do this when a proxy really sits in front of the site, because visitors can forge these headers otherwise.
No. Only the admin screens and the login page are protected. admin-ajax.php, wp-cron.php, WP-CLI and front-end form submissions to admin-post.php are left alone so themes and plugins keep working for every visitor.
Yes. Use CIDR notation, for example 203.0.113.0/24 for an IPv4 range or 2001:db8::/32 for IPv6.
Use the awesoft_ip_whitelist_allowed filter. It receives the current decision, the visitor's candidate IP addresses and the configured rules, and must return a boolean.
AWESOFT_IP_WHITELIST_DISABLE emergency constant and awesoft_ip_whitelist_allowed filter.X-Forwarded-For header is no longer trusted by default; it could be forged to bypass the whitelist.admin-post.php submissions are no longer blocked for non-whitelisted visitors.login_init action instead of the authenticate filter.