Added a woocommerce_disable_api_access_log filter. (#37332)
Co-authored-by: Mindaugas Budreika <mindaugas.budreika@thecoffeemate.group> Co-authored-by: Néstor Soriano <konamiman@konamiman.com>
This commit is contained in:
parent
a4a2ef732d
commit
e725a98f35
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: enhancement
|
||||
|
||||
Added a woocommerce_disable_api_access_log filter to disable last access logging for rest api.
|
|
@ -587,6 +587,19 @@ class WC_REST_Authentication {
|
|||
private function update_last_access() {
|
||||
global $wpdb;
|
||||
|
||||
/**
|
||||
* This filter enables the exclusion of the most recent access time from being logged for REST API calls.
|
||||
*
|
||||
* @param bool $result Default value.
|
||||
* @param int $key_id Key ID associated with REST API request.
|
||||
* @param int $user_id User ID associated with REST API request.
|
||||
*
|
||||
* @since 7.7.0
|
||||
*/
|
||||
if ( apply_filters( 'woocommerce_disable_rest_api_access_log', false, $this->user->key_id, $this->user->user_id ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$wpdb->update(
|
||||
$wpdb->prefix . 'woocommerce_api_keys',
|
||||
array( 'last_access' => current_time( 'mysql' ) ),
|
||||
|
|
Loading…
Reference in New Issue