| 开发者 | birimone |
|---|---|
| 更新时间 | 2026年11月26日 05:13 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
/wp-json/) for visitors who are not logged in, and stop user enumeration, without breaking contact forms, WooCommerce or the block editor. A maintained replacement for Disable REST API, with one-click settings import.
WordPress exposes a public REST API at /wp-json/. Anyone can list your users, your installed plugins' endpoints and your content. Birim REST Lock closes it without breaking your site.
/wp/v2/posts* covers /wp/v2/posts and /wp/v2/posts/123./wp/v2/users.Link header and RSD.OPTIONS) requests pass through, so token logins keep working.birim_rest_lock_blocked filter: ( bool $blocked, string $route, WP_REST_Request $request ) to override the decision.birim_rest_lock_message filter: change the error message.birim-rest-lock folder to /wp-content/plugins/.Open https://yoursite.com/wp-json/wp/v2/users in your browser. You should get a 401 error. This happens even while you are logged in: WordPress treats a browser visit to /wp-json/ without a security nonce as logged out. The block editor and admin screens send the nonce, so they keep working.
Install and activate. The default allowlist already lets Contact Form 7, WooCommerce block checkout, oEmbed and Jetpack through, so forms keep sending while everything else in /wp-json/ is closed to logged-out visitors.
That plugin calls the REST API for logged-out visitors. Settings > REST Lock lists the namespaces on your site. Add the plugin's namespace (for example /my-plugin/v1) to the allowlist.
No. It controls routes registered with the WordPress REST API only.
Activate REST Lock and open Settings > REST Lock. Click "Import from Disable REST API", review the result, then deactivate Disable REST API. The import copies the logged-out allowlist and turns roles you managed there into restricted roles. Per-role route lists are not copied; restricted roles share the logged-out rules.
No. Administrators are never blocked, and other logged-in users are only restricted if you choose their role. Do not restrict roles that write posts.
Please email security@birim.one instead of posting in the forum. See https://plugins.birim.one/security/ for the full policy.