简体   繁体   中英

How to change default email reset link for the WordPress reset a password

I want to change the default WordPress e-mail URL so that it is not directed to the wp-login.php page after the user registers but another page.

Below is a screenshot showing the section of a WordPress email containing the URL I want to alter;

包含默认登录页面URL的WordPress电子邮件屏幕截图

How can I achieve it?

WordPress User Registrations, Password Reset emails are using the pluggable.php file. (/wp-includes/pluggable.php) . There are two ways to achieve your request.

  1. Modify the /wp-includes/pluggable.php file. : Not preferred/advised but an easy way. For the example above modify the line number 1903 (Referring to branch 5.0.2 https://core.trac.wordpress.org/browser/tags/5.0.1/src/wp-includes/pluggable.php#L0 )

  2. Extend the functionality with functions.php In the following example, the user notification will redirect the user to different URL.

     add_filter( 'wp_new_user_notification_email', 'custom_wp_new_user_notification_email', 10, 3 ); function custom_wp_new_user_notification_email( $wp_new_user_notification_email, $user, $blogname ) { $wp_new_user_notification_email['subject'] = sprintf( '[%s] New user %s registered.', $blogname, $user->user_login ); $wp_new_user_notification_email['message'] = sprintf( "%s ( %s ) has registerd to your blog %s.", $user->user_login, $user->user_email, "To Change your password visit: https://google.com" ); return $wp_new_user_notification_email; } 

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