Tuesday, September 1, 2020

WordPress - Disable Lost your password Link and Page Code

 // Disable Lost your password Link and Page

function remove_lostpassword_text ( $text ) {

         if ($text == 'Lost your password?'){$text = '';}

                return $text;

         }

add_filter( 'gettext', 'remove_lostpassword_text' );


add_action('init','possibly_redirect'); 

function possibly_redirect(){ 

   if (isset( $_GET['action'] )){  

     if ( in_array( $_GET['action'], array('lostpassword', 'retrievepassword') ) ) {

        wp_redirect( '/wp-login.php' ); exit;

     }

  }

}