I want to add a custom link before the 'Lost your password?' link. I'm currently using a function that has some css to style my wordpress login page(I don't have a separate page for the login page). Any thoughts on how to do this?

3 Answers 3


Well, you can add link after lost your password, but I don't think you can add link before lost your password link unless you design your own login page.

function hook_lost_your_password ( $text ) {
        if ($text == 'Lost your password?'){
            $text .= '<br /><a href="http://codebing.com">Visit Code Bing</a>';
    return $text;
add_filter( 'gettext', 'hook_lost_your_password' );

Source (Code Bing)


There are few login form hooks which could be useful to you:

login_form AND login_footer

You can find more information about them in the Codex: Customizing_the_Login_Form#Login_Hooks


Use the clean url filter to add the new link in an evil way.

add_filter( 'clean_url', 'wpse_99251_add_anchor_to_login_form', 10, 2 );
 * Add an anchor (link) to the login form.
function wpse_99251_add_anchor_to_login_form( $good_protocol_url, $original_url ) {

    // Check to see if we are on the login page and escaping the "Lost Password?" url.
    if ( 'wp-login.php' == $GLOBALS['pagenow'] && $original_url == wp_lostpassword_url() ) {

        // If we get here, we are inside the href atribute of the lost password anchor.
        // So, the anchor we add starts in its middle.
        return sprintf(
            '%s" title="%s">%s</a> | <a href="%s',
            esc_url( 'https://my_link' ),           // Change to your link url.
            esc_attr( 'My Link Title' ),            // Change to your link title.
            'My Link Name',                         // change to your link name.

    return $good_protocol_url;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.