Cannot modify headers

When you redirect via wp_safe_redirect, this is done by sending a header to the browser containing the URL to redirect to. If any content has been sent to the browser before trying to send this header, you get the headers already sent error. Once content goes to the browser, happy header time is over, no … Read more

Can we stop session reset if page reloads?

WordPress doesn’t use PHP sessions. If you tried stating a session in your custom-written code, it’s not going to work as you’d hope. There’s a plugin which will enable all normal session use: https://wordpress.org/plugins/wp-native-php-sessions/ But, depending on what exactly you’re trying to achieve, you may prefer to keep things clean/do it the WordPress way and … Read more

Redirecting to a custom forgot password page

Yep, there’s a hook to change the lost password URL. I found it by going to this nice page to search all the hooks and filters and selecting ‘Hooks’ and trying ‘lost password’ https://developer.wordpress.org/reference/ An example from here: https://codex.wordpress.org/Plugin_API/Filter_Reference/lostpassword_url add_filter( ‘lostpassword_url’, ‘my_lost_password_page’, 10, 2 ); function my_lost_password_page( $lostpassword_url, $redirect ) { return home_url( “/yournew/lostpasswordpage.php” ); … Read more

Customize retrieve password message

You aren’t requesting all of the parameters that your callback needs.This: add_filter ( ‘retrieve_password_message’, ‘retrieve_password_message_filter’); Should be: add_filter ( ‘retrieve_password_message’, ‘retrieve_password_message_filter’, 10 ,4); Though you only need the first three, it looks loke.

How to change “Reset Password” text on submit button

I’ve added jQuery( document ).ready(function() { and it works! Final working code below: add_action( ‘resetpass_form’, ‘resettext’); function resettext(){ ?> <script type=”text/javascript”> jQuery( document ).ready(function() { jQuery(‘#resetpassform input#wp-submit’).val(“Set Password”); }); </script> <?php }

Send password to user instead of reset password link

You can use retrieve_password_message hook for that. That filter is applied as this: apply_filters( ‘retrieve_password_message’, string $message, string $key, string $user_login, WP_User $user_data ) So you’ll have access to $user_login of the user. It means, that you can write a filter function that will create random password for that user and then send it. function … Read more