0

The login form on the page wp-login.php has a title at the bottom that says "<- Back to website-name" This title then always redirects to the home page, but I want the title just reading "back to website-name" so I just want the "<-" removed.

I imagine this requires a hook added to functions.php but I'm not sure how and could not find anything while searching online.

Any suggestions please let me know, thanks!

1

Please add below code to your functions.php to remove the &larr; from the translated string:

/**
 * Remove &larr; from the '&larr; Back to %s' translation
 */
add_action( 'login_init', function()
{
    add_filter( 'gettext', 'wpse_back_to_site_text', 10, 2 );
} );

function wpse_back_to_site_text( $translated, $untranslated )
{
    // Target the untranslated string
    if( '&larr; Back to %s' === $untranslated )
    {
        // Remove the filter callback
        remove_filter( current_filter(), __FUNCTION__ );

        // Modify the translation
        $translated = __( 'Back to %s' );
    }
    return $translated;
}

where we initiate our custom gettext filter callback, to run only within the login_init hook, to restrict it to the login page.

For details please follow source and details

  • What about wrapping this instead into the login_init hook, as the gettext is an "expensive" filter and remove it as soon as we have a match. I think we can skip the string replacement as well, and just assign it the new string value. – birgire Jan 21 '16 at 10:02
  • Thanks for useful information, you can update or provide answer!! – jas Jan 21 '16 at 10:20
  • 1
    I updated the answer accordingly (ps. wp-register.php was removed from core years ago, see #18544) – birgire Jan 21 '16 at 12:54
  • Thanks for improving with better approach and useful deatils @birgire – jas Jan 21 '16 at 12:59
  • Thanks for the assistance! Can you care to explain how you figured this out as I found it rather difficult to take on myself. – Gareth Bolton Jan 21 '16 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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