| 开发者 | slaacr |
|---|---|
| 更新时间 | 2026年6月18日 23:53 |
| PHP版本: | 8.2 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
rest_authentication_errors filter — the correct, modern WordPress approach — to intercept REST API requests early in the lifecycle, before any endpoint logic executes. This means blocked requests have virtually zero performance impact.
Built for Performance
This plugin follows the MaxtDesign performance-first philosophy:
maxtdesign-rest-api-control folder to /wp-content/plugins/.No. The plugin only affects REST API requests. Your website's frontend, admin dashboard, and all standard WordPress functionality remain completely unaffected. Logged-in users have full REST API access by default.
Yes. Contact Form 7 requires the REST API for form submissions. The plugin automatically detects CF7 on activation and whitelists its endpoints. If you activate CF7 after this plugin, simply check the contact-form-7 namespace in the endpoint whitelist.
Yes. The plugin automatically detects WooCommerce on activation and whitelists the Store API endpoints (wc/store) needed for cart and checkout blocks. The WooCommerce admin API endpoints are available to logged-in users by default.
Your REST API returns to normal WordPress behavior — fully open. Your settings are preserved so they'll be restored if you reactivate. Settings are only deleted when you delete the plugin through the WordPress admin.
No. By default the plugin only restricts unauthenticated requests, and every logged-in user keeps full REST API access — so the block editor, which talks to the REST API as the logged-in author, is completely unaffected. The "Allow REST API for all logged-in users" toggle is on out of the box specifically to keep the editor, dashboard, and admin AJAX working. You would only see editor issues if you deliberately turn that toggle off and restrict your own role without whitelisting wp/v2 — which the per-role UI makes explicit.
Yes. The Per-Role Controls section lets you restrict REST API access for individual roles (subscriber, contributor, author, editor, etc.) and configure a custom endpoint whitelist for each restricted role.
The most permissive role wins. If a user holds any role that is not restricted, they keep full REST API access. If every one of their roles is restricted, the plugin combines the whitelists of all those roles and allows a request that any of them permits. This prevents a single restricted role (for example a stray subscriber capability) from unexpectedly locking out a user who also has an unrestricted role.
Yes. The plugin auto-discovers all registered REST API endpoints, including those from themes and other plugins. Any custom endpoints will appear in the whitelist tree.
Use the Export Settings button to download a JSON file, then use Import Settings on the other site to upload it.
maxtdesign-rest-api-control) so the plugin can be translated through the WordPress.org translation system. No functional change.wp/v2/posts/(?P<id>[\d]+) previously stored a corrupted value (the sanitiser mangled the regex) and could never match a real request. Route patterns are now stored intact and matched the way WordPress itself matches them. Namespace-level whitelisting was unaffected./wp-json/) is now blocked when "Disable REST API for unauthenticated users" is on. Previously, the controller's route-lookup returned an empty string for the root index and the code took an early fail-open branch — meaning the most-scraped discovery URL was always exposed even when the plugin was active. Logged-out visitors and unauthenticated scrapers now hit the configured error response on /wp-json/ like any other endpoint.is_uploaded_file() and reads the temp file directly instead of mis-sanitising the server-generated path.wp-admin/includes/plugin.php before calling is_plugin_active() so WP-CLI and multisite bulk-activate paths can't fatal.load_plugin_textdomain() call. WordPress.org handles translation loading automatically since WP 4.6, and the just-in-time loader added in 6.7 made the explicit call dead code.