WC_Rate_Limiter::set_rate_limit
Sets the rate limit delay in seconds for action with identifier $id.
Метод класса: WC_Rate_Limiter{}
Хуков нет.
Возвращает
true|false. True if the option setting was successful, false otherwise.
Использование
$result = WC_Rate_Limiter::set_rate_limit( $action_id, $delay );
- $action_id(строка) (обязательный)
- Identifier of the action.
- $delay(int) (обязательный)
- Delay in seconds.
Код WC_Rate_Limiter::set_rate_limit() WC Rate Limiter::set rate limit WC 10.3.5
public static function set_rate_limit( $action_id, $delay ) {
global $wpdb;
$next_try_allowed_at = time() + $delay;
$result = $wpdb->replace(
$wpdb->prefix . 'wc_rate_limits',
array(
'rate_limit_key' => $action_id,
'rate_limit_expiry' => $next_try_allowed_at,
),
array( '%s', '%d' )
);
self::set_cache( $action_id, $next_try_allowed_at );
return false !== $result;
}