WC_Rate_Limiter::set_rate_limit()
Sets the rate limit delay in seconds for action with identifier $id.
Method of the class: WC_Rate_Limiter{}
No Hooks.
Return
true|false
. True if the option setting was successful, false otherwise.
Usage
$result = WC_Rate_Limiter::set_rate_limit( $action_id, $delay );
- $action_id(string) (required)
- Identifier of the action.
- $delay(int) (required)
- Delay in seconds.
WC_Rate_Limiter::set_rate_limit() WC Rate Limiter::set rate limit code WC 8.6.1
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; }