Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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');
share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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