Filter hook 'recovery_mode_cookie_length'

in WP Core File wp-includes/class-wp-recovery-mode-cookie-service.php at line 99

View Source

recovery_mode_cookie_length

Filter Hook
Description
Validates the recovery mode cookie.

Hook Information

File Location wp-includes/class-wp-recovery-mode-cookie-service.php View on GitHub
Hook Type Filter
Line Number 99

Hook Parameters

Type Name Description
string $cookie Optionally specify the cookie string. If omitted, it will be retrieved from the super global.

Usage Examples

Basic Usage
<?php
// Hook into recovery_mode_cookie_length
add_filter('recovery_mode_cookie_length', 'my_custom_filter', 10, 1);

function my_custom_filter($cookie) {
    // Your custom filtering logic here
    return $cookie;
}

Source Code Context

wp-includes/class-wp-recovery-mode-cookie-service.php:99 - How this hook is used in WordPress core
<?php
  94  		if ( ! ctype_digit( $created_at ) ) {
  95  			return new WP_Error( 'invalid_created_at', __( 'Invalid cookie format.' ) );
  96  		}
  97  
  98  		/** This filter is documented in wp-includes/class-wp-recovery-mode-cookie-service.php */
  99  		$length = apply_filters( 'recovery_mode_cookie_length', WEEK_IN_SECONDS );
 100  
 101  		if ( time() > $created_at + $length ) {
 102  			return new WP_Error( 'expired', __( 'Cookie expired.' ) );
 103  		}
 104  

PHP Documentation

<?php
/**
	 * Validates the recovery mode cookie.
	 *
	 * @since 5.2.0
	 *
	 * @param string $cookie Optionally specify the cookie string.
	 *                       If omitted, it will be retrieved from the super global.
	 * @return true|WP_Error True on success, error object on failure.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/class-wp-recovery-mode-cookie-service.php
Related Hooks

Related hooks will be displayed here in future updates.