admin管理员组文章数量:1295065
After password is reset in Wordpress, the message comes as "Your password has been reset. Login" How do I customise this message?
do_action( 'validate_password_reset', $errors, $user );
if ( ( ! $errors->has_errors() ) && isset( $_POST['pass1'] ) && ! empty( $_POST['pass1'] ) ) {
reset_password( $user, $_POST['pass1'] );
setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
login_header( __( 'Password Reset' ), '<p class="message reset-pass">' . __( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a></p>' );
login_footer();
exit;
}
This is the code I am looking at in wp-login.php. I just want to change the message alone. Any help is appreciated.
After password is reset in Wordpress, the message comes as "Your password has been reset. Login" How do I customise this message?
do_action( 'validate_password_reset', $errors, $user );
if ( ( ! $errors->has_errors() ) && isset( $_POST['pass1'] ) && ! empty( $_POST['pass1'] ) ) {
reset_password( $user, $_POST['pass1'] );
setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
login_header( __( 'Password Reset' ), '<p class="message reset-pass">' . __( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a></p>' );
login_footer();
exit;
}
This is the code I am looking at in wp-login.php. I just want to change the message alone. Any help is appreciated.
Share Improve this question asked Apr 16, 2021 at 2:30 GeneralNinjaGeneralNinja 11 silver badge1 bronze badge1 Answer
Reset to default 1Looking at the login_header()
function, it appears that you can use the login_message
filter.
add_filter( 'login_message', 'wpse386695_change_message' );
function wpse386695_change_message( $message ) {
$message = str_replace(
'Your password has been reset',
__( 'The text you want to appear', 'plugin-text-domain' ),
$message
);
return $message;
}
Update
To replace the entire login_message
string with your own URL (as requested in the comments), you can do this instead:
add_filter( 'login_message', 'wpse386695_replace_message' );
function wpse386695_replace_message( $message ) {
$message = '<p class="message reset-pass">'
. __( 'Your password has been reset.' )
. ' <a href="' . esc_url( 'https://example/my-login-url' )
. '">' . __( 'Log in' ) . '</a></p>'
return $message;
}
...replacing https://example/my-login-url
with the URL you need, of course.
本文标签: customizationChange Successful password reset message
版权声明:本文标题:customization - Change Successful password reset message 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741613556a2388397.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论