mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
https://github.com/wavvves/activate-store-api-rate-limiting/blob/main/activate-store-api-rate-limiting.php https://developer.woocommerce.com/2022/11/22/store-api-now-supports-rate-limiting/
9 lines
664 B
Text
9 lines
664 B
Text
add_filter( 'woocommerce_store_api_rate_limit_options', function() {
|
|
|
|
return [
|
|
'enabled' => defined('STORE_API_RATE_LIMITING_ENABLED') ? STORE_API_RATE_LIMITING_ENABLED : true, // enables/disables Rate Limiting
|
|
'proxy_support' => defined('STORE_API_RATE_LIMITING_PROXY_SUPPORT') ? STORE_API_RATE_LIMITING_PROXY_SUPPORT : false, //enables/disables Proxy support. Default:false
|
|
'limit' => defined('STORE_API_RATE_LIMITING_LIMIT') ? STORE_API_RATE_LIMITING_LIMIT : 25, // limit of request per timeframe. Default: 25
|
|
'seconds' => defined('STORE_API_RATE_LIMITING_SECONDS') ? STORE_API_RATE_LIMITING_SECONDS : 10, // timeframe in seconds. Default: 10
|
|
];
|
|
} );
|