使用password_reset
钩
function wpse_password_reset( $user, $new_pass ) {
//* Do something useful with $new_pass
}
add_action( \'password_reset\', \'wpse_password_reset\', 10, 2 );
编辑以在注释后添加:
看起来我不能使用的原因是插件使用wp\\u update\\u user来设置新密码。在此之前,我是否可以拦截密码?
对您可以使用send_password_change_email
滤器
function wpse_send_password_change_email( $true, $user, $userdata ) {
//* Do something useful with the new password
wp_die(
sprintf(
\'%1$s changed their password to %2$s.\',
$userdata[ \'user_login\' ],
$_POST[ \'pass1\' ]
)
);
//* Need to return $true since it\'s a filter
return $true;
}
add_filter( \'send_password_change_email\', \'wpse_send_password_change_email\', 10, 3 );