Download the PHP package frosty-media/wp-rest-cop without Composer
On this page you can find all versions of the php package frosty-media/wp-rest-cop. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download frosty-media/wp-rest-cop
More information about frosty-media/wp-rest-cop
Files in frosty-media/wp-rest-cop
Package wp-rest-cop
Short Description A WordPress plugin for managing access to the WP REST API.
License GPL-2.0-or-later
Informations about the package wp-rest-cop
WP REST Cop
Manage access to the WP REST API with rate limits and IP-based rules.
Rate Limits
Rate limits allow for configuring the number of requests a client can make within a certain interval. The default in WP Rest Cop is 60 requests per minute.
The rate limit functionality uses transients which will use persistent object cache if present.
Headers
A few headers are sent with every request so clients can keep track of their current limit:
| Header | Description |
|---|---|
X-Rate-Limit-Limit |
Requests allowed per interval. |
X-Rate-Limit-Rules |
Default rule set to client "Ip". |
X-Rate-Limit-Remaining |
Remaining requests that are allowed in the current interval. |
X-Rate-Limit-Reset |
Seconds until the limit is reset. |
If a client has reached their limit, an additional header will be sent:
| Header | Description |
|---|---|
Retry-After |
Seconds until the limit is reset. |
Clients may send a HEAD request to view their current limit without ticking the meter.
Configuring Settings
Configure the default interval & limit settings using the simple API from the main plugin instance:
Settings can also be configured with the built-in WP CLI commands.
Disable Rate Limiting
If you just want the IP rules functionality and want to disable the rate limits, set the interval to -1. Or, filter
the current request:
IP Rules
IP rules can be configured globally, or at the route level as a simple allowlist or blocklist.
Global Configuration
When allowing an IP address, the policy is to deny any requests from IPs not in the allowlist.
The opposite is true when denying IP addresses. All IPs not in the blocklist will have access.
Global IP rules can also be configured with the built-in WP CLI commands.
Route Configuration
Routes may also be configured with their own IP rules:
WP CLI Commands
A few WP CLI commands are included to configure the plugin without requiring code.
| Command | Description |
|---|---|
wp restcop allow <ip> |
Allow one or more IPs. |
wp restcop check <ip> |
Check whether an IP has access. |
wp restcop deny <ip> |
Deny one or more IPs |
wp restcop set <key> <value> |
Update a setting value. |
wp restcop status |
View global IP rules. |
Potential Roadmap
- Support for logging various events.
- Additional rate limit strategies.
- More route-level capabilities.
- Advanced access rules.
All versions of wp-rest-cop with dependencies
dwnload/wp-settings-api Version ^3.11
pimple/pimple Version ~3.0
symfony/http-foundation Version ^7.1.7
thefrosty/wp-utilities Version ^3.3