Uses
Uses | Description |
---|---|
wp-includes/pluggable.php: wp_generate_password() | Generates a random password drawn from the defined set of characters. |
wp-includes/post.php: wp_update_post() | Update a post with new post data. |
Returns a confirmation key for a user action and stores the hashed version for future comparison.
(int) (Required) Request ID.
(string) Confirmation key.
File: wp-includes/user.php
function wp_generate_user_request_key( $request_id ) { global $wp_hasher; // Generate something random for a confirmation key. $key = wp_generate_password( 20, false ); // Return the key, hashed. if ( empty( $wp_hasher ) ) { require_once ABSPATH . WPINC . '/class-phpass.php'; $wp_hasher = new PasswordHash( 8, true ); } wp_update_post( array( 'ID' => $request_id, 'post_status' => 'request-pending', 'post_password' => $wp_hasher->HashPassword( $key ), ) ); return $key; }
Version | Description |
---|---|
4.9.6 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_generate_user_request_key