2

I am customising the login page and would like to alter the footer text that takes the user back to the website. Ideally and as an example, changing it from the first image, to the second just below:

  1. enter image description here

  2. enter image description here

I've searched around a bit but can't seem to find the answer I'm looking for in modifying the text. The closest I have is changing the Register or Lost your password? text, but can't apply this script to the third user option.

functions.php:

function back_to_site_text( $translated ) {
     $translated = str_ireplace(  '← Back to My Site', 'Head back to My Site',  $translated );
     return $translated;
}

add_filter('gettext', 'back_to_site_text');
add_filter('ngettext',  'back_to_site_text');

How do I change the footer text on the login page that takes the user back to the main website?

5

You have the wrong values , you can't use , instead use the right encoding which in that case is ← and also %s for the title.

Also you only want this to run on two pages.

function back_to_site_text( $translated ) {

    if ( in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) ) )
        $translated = str_ireplace(  '← Back to %s', 'Head back to My Site',  $translated );
        return $translated;
}
 add_filter('gettext', 'back_to_site_text');
  • Keep in mind that RTL people might use a different arrow ;) – kaiser Oct 18 '13 at 6:13
  • Does this cause all text rendered through the system to go through this function? I like this solution better - I think the javascript technique is very hacky. Nice. – cale_b Oct 18 '13 at 14:24
  • More or less yes (as far as I know) , but the function above will only run on 2 pages since I added a conditional. – Wyck Oct 18 '13 at 15:54

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.