简体   繁体   中英

Need to request forget password in Wordpress for a user programatically

WordPress中是否有一个功能可以将用户名传递给它,并且可以重置其密码并发送包含新登录详细信息的电子邮件?

You can use

<?php wp_set_password( $password, $user_id ) ?>

in which you can specify $password = anything you want.

and then after wp_mail to send mail to user.

You can use the two neat WordPress functions wp_new_user_notification() and wp_set_password() .

The first notify the blog administrator of a new user, normally via email and also send an email with login/password to the new user. The second updates the user's password with a new encrypted one.

Usage:

 <?php wp_new_user_notification( $user_id, $plaintext_pass ) ?>

and

<?php wp_set_password( $password, $user_id ) ?>

Documentation here and here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM