• what is the best way to modify the following function call in the wp-login.php?
    what I would like is to replace <p class="message reset-pass"> with <p><br>

    
    login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors );
    

    obviously modify wp-login.php is not a good idea as upgrade will always overwrite it. I was going to use the following function but not sure if login_header is correct? thanks.

    
    function loginoverrides() {    
    }
    add_action( 'login_header', 'loginoverrides' );
    
    • This topic was modified 7 years, 4 months ago by Jan Dembowski. Reason: Fixed formatting
Viewing 5 replies - 1 through 5 (of 5 total)
  • No, there is a filter for the message.

    function my_login_messge( $message ) {   
      //change the $message
      return $message; 
    }
    add_filter( 'login_message', 'my_login_messge', 10, 1 );

    If this is just for your site, you can put your message straight in there. But if it’s for a plugin, consider that the message is already translated, and the classes that are on there are probably needed for styling and perhaps for javascript. If you change it much, other plugins that style the login or enhance it in other ways might not work correctly.

    Thread Starter wpdev123456

    (@wpdev123456)

    Hello Joy,

    thank you for your suggestion. Your function will replace the message. However, I would like to remove the box around the message “Enter the new password below” – refer to screenshot -`https://ibb.co/sQLLm4r

    this class <p class=”message reset-pass”> create the box. I can either change <p class=”message reset-pass”> to <p>, which will remove the box or I have to modify the css, which I have no idea where the message reset-pass css reside.

    thanks.

    Moderator bcworkz

    (@bcworkz)

    Altering CSS makes much more sense than trying to change unfiltered HTML. It doesn’t matter where the current CSS is because the strategy is to override the current CSS with the same selector, but parsed later by the browser. See the Codex for how to do this.

    FWIW, you can locate where any CSS rule is for any element on a page by using your browser’s developer tools. These tools are indispensable for altering any CSS. I urge you to learn to use them, especially the CSS or element inspector.

    To modify the CSS, you will need to either add_action to the head section or add_action to the enqueue. The standard front end CSS is not loaded on this page, so you would have to go to a little more work to override it.
    You might find it easier to use a plugin that helps you customize your login page, rather than this piecemeal approach.

    Thread Starter wpdev123456

    (@wpdev123456)

    thanks for your great info. I will look into this.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘wp-login.php’ is closed to new replies.