recovery_mode_cookie_length WordPress Filter Hook
The recovery_mode_cookie_length hook is used to set the duration of time for which a user will be able to stay in recovery mode. This hook is useful for site administrators who want to limit the amount of time a user can spend in recovery mode. By default, WordPress allows a user to stay in recovery mode for 24 hours. However, if a site administrator wants to limit the duration of time a user can spend in recovery mode, they can use this hook to do so. In order to use this hook, a site administrator must first add the following line of code to their wp-config.php file: define('RECOVERY_MODE_COOKIE_LENGTH', 3600); This line of code defines the duration of time, in seconds, for which a user will be able to stay in recovery mode. In this example, the duration is set to 3600 seconds, or one hour. Once the line of code has been added to the wp-config.php file, a site administrator can then use the recovery_mode_cookie_length hook in their functions.php file to limit the duration of time a user can spend in recovery mode. For example, the following code would limit the duration of time a user can spend in recovery mode to 30 minutes: add_filter( 'recovery_mode_cookie_length', function( $length ) { return 1800; // 30 minutes } ); This code would need to be added to the functions.php file in the theme directory. By default, WordPress allows a user to stay in recovery mode for 24 hours. However, this duration can be changed by a site administrator using the recovery_mode_cookie_length hook. This hook is useful for site administrators who want to limit the amount of time a user can spend in recovery mode.
apply_filters( 'recovery_mode_cookie_length', int $length ) #
Filters the length of time a Recovery Mode cookie is valid for.
Parameters
- $length
(int)Length in seconds.
Source
Changelog
Version | Description |
---|---|
5.2.0 | Introduced. |