Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of correcting the link error of WordPress password setting

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you to correct the WordPress password setting link error method, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

Press tutorial column to introduce you to correct WordPress password setting link error method, hope to help friends in need!

When a user registers or forgets a password to get a new password, WordPress automatically sends an authentication link address to the user's mailbox. The user sets the password by opening this link, but often finds that the link is not the correct link to set the password when the link is opened directly.

The reason for this problem is not WordPress. There is no hyperlink in the link address of the normal WordPress password, but QQ Mail is smart enough to add a hyperlink to a link address and add symbols that are not the content of the link address, resulting in a link error. It seems that only QQ Mail, which is commonly used, has this problem. This is a clich é problem, online solutions can be found everywhere, but they are all the same, which fully reflects a big copy of the articles all over the world.

Here is my solution, taking WordPress 5.3.2 as an example:

First, the simplest way

Modify the WordPress program file to delete symbols in the code

Fixed forgot password to get new password link

Open the wp-login.php file in the root directory of the WordPress program, and change about 417 lines of:

$message. ='/','\ 1password, $string);} / modify user registration settings password link add_filter ('wp_new_user_notification_email',' zm_user_notification_email_amend', 10,3); function zm_user_notification_email_amend ($wp_new_user_notification_email, $user, $user_email) {global $wpdb, $wp_hasher;$key = wp_generate_password (20, false) Do_action ('retrieve_password_key', $user- > user_login, $key); if (empty ($wp_hasher)) {require_once ABSPATH. WPINC. '/ class-phpass.php';$wp_hasher = new PasswordHash (8, true);} $hashed = time (). ':. $wp_hasher- > HashPassword ($key); $wpdb- > update ($wpdb- > users, array ('user_activation_key' = > $hashed), array (' user_login' = > $user- > user_login)); $switched_locale = switch_to_locale (get_user_locale ($user)); $message = sprintf (_ (Username:% s'), $user- > display_name). "\ r\ n\ r\ n"; $message. = _ ('To set your password, visit the following address:'). "\ r\ n\ r\ n"; $message. ='. Network_site_url ("wp-login.php?action=rp&key=$key&login=". Rawurlencode ($user- > user_login), 'login'). "\ r\ n\ r\ n"; $wp_new_user_notification_email ['message'] = $message;return $wp_new_user_notification_email;}

A way to correct the reset password link can be found on the Internet, but the code is a little procrastinating, and the method in this article is only a key code solution.

As for the correction of user registration settings password links, after rewriting the mail function to solve, it seems that there is room for simplification of the code, we will study it later.

The above is all the contents of the method to correct the WordPress password setting link error, thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report