random_password
Filter HookDescription
Filters the randomly-generated password.Hook Information
File Location |
wp-includes/pluggable.php
View on GitHub
|
Hook Type | Filter |
Line Number | 2882 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$password
|
The generated password. |
int
|
$length
|
The length of password to generate. |
bool
|
$special_chars
|
Whether to include standard special characters. |
bool
|
$extra_special_chars
|
Whether to include other special characters. |
Usage Examples
Basic Usage
<?php
// Hook into random_password
add_filter('random_password', 'my_custom_filter', 10, 4);
function my_custom_filter($password, $length, $special_chars, $extra_special_chars) {
// Your custom filtering logic here
return $password;
}
Source Code Context
wp-includes/pluggable.php:2882
- How this hook is used in WordPress core
<?php
2877 * @param string $password The generated password.
2878 * @param int $length The length of password to generate.
2879 * @param bool $special_chars Whether to include standard special characters.
2880 * @param bool $extra_special_chars Whether to include other special characters.
2881 */
2882 return apply_filters( 'random_password', $password, $length, $special_chars, $extra_special_chars );
2883 }
2884 endif;
2885
2886 if ( ! function_exists( 'wp_rand' ) ) :
2887 /**
PHP Documentation
<?php
/**
* Filters the randomly-generated password.
*
* @since 3.0.0
* @since 5.3.0 Added the `$length`, `$special_chars`, and `$extra_special_chars` parameters.
*
* @param string $password The generated password.
* @param int $length The length of password to generate.
* @param bool $special_chars Whether to include standard special characters.
* @param bool $extra_special_chars Whether to include other special characters.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-includes/pluggable.php
Related Hooks
Related hooks will be displayed here in future updates.