WP_Recovery_Mode_Key_Service::clean_expired_keys( int $ttl )

In this article

Removes expired recovery mode keys.

Parameters

$ttlintrequired
Time in seconds for the keys to be valid for.

Source

public function clean_expired_keys( $ttl ) {

	$records = $this->get_keys();

	foreach ( $records as $key => $record ) {
		if ( ! isset( $record['created_at'] ) || time() > $record['created_at'] + $ttl ) {
			unset( $records[ $key ] );
		}
	}

	$this->update_keys( $records );
}

Changelog

VersionDescription
5.2.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.