wp_create_application_password
云策文档标注
概述
wp_create_application_password 是一个 WordPress 动作钩子,在创建应用程序密码时触发。它允许开发者在密码生成后执行自定义操作,例如记录或通知。
关键要点
- 这是一个动作钩子,用于在应用程序密码创建时触发事件。
- 钩子传递用户ID、密码详情、明文密码和创建参数等数据。
- 参数包括 $user_id(用户ID)、$new_item(密码详情数组)、$new_password(明文密码)和 $args(创建参数数组)。
- 与 WP_Application_Passwords::create_new_application_password() 函数相关,用于创建新密码。
- 自 WordPress 5.6.0 引入,6.8.0 版本中哈希算法从 phpass 改为 wp_fast_hash()。
代码示例
do_action( 'wp_create_application_password', $user_id, $new_item, $new_password, $args );
原文内容
Fires when an application password is created.
Parameters
$user_idint-
The user ID.
$new_itemarray-
The details about the created password.
uuidstringThe unique identifier for the application password.app_idstringA UUID provided by the application to uniquely identify it.namestringThe name of the application password.passwordstringA one-way hash of the password.createdintUnix timestamp of when the password was created.last_usednullNull.last_ipnullNull.
$new_passwordstring-
The generated application password in plain text.
$argsarray-
Arguments used to create the application password.
namestringThe name of the application password.app_idstringA UUID provided by the application to uniquely identify it.
Source
do_action( 'wp_create_application_password', $user_id, $new_item, $new_password, $args );
Changelog
| Version | Description |
|---|---|
| 6.8.0 | The hashed password value now uses wp_fast_hash() instead of phpass. |
| 5.6.0 | Introduced. |