Edit The functions.php file is usually located inside the currently active WordPress theme directory.
/wp-content/themes/your-active-theme/functions.php
Add the below code at the bottom.
/*Prevents users from resetting their password via the WordPress Login forms*/ /*Note the priority of this filter – it is specifically set to 30, so it can override other of its declarations in the code*/ add_filter( ‘allow_password_reset’, ‘__return_false’, 30, 1 ); /*Disables direct access to password reset forms present in WordPress Login interface*/ add_action( “login_init”, function() { if (isset( $_GET[‘action’] )){ if ( in_array( $_GET[‘action’], array(‘lostpassword’, ‘retrievepassword’) ) ) { wp_redirect( wp_login_url(), 301 ); exit; } } }); /*Removes the “Lost your password” text from login screen*/ add_filter( ‘lost_password_html_link’, ‘__return_false’ );
Comments are closed