6

I am trying to change the login logo URL and hover title. I am using the code below but return bloginfo('url'); and return bloginfo('name'); aren't outputting the desired href and title. I'm also using a child theme if that matters at all. What do I need to use instead of return bloginfo('url'); and return bloginfo('name');?

/* ==  Change Logo URL ==============================*/

function my_url_login(){
    return bloginfo('url');
}
add_filter('login_headerurl', 'my_url_login');


/* ==  Change Logo URL Hover Text ==============================*/
function my_url_login_hover(){
     return bloginfo('name');
}
add_filter('login_headertitle', 'my_url_login_hover');

2 Answers 2

12

Try these filters instead

// changing the logo link from wordpress.org to your site
function mb_login_url() {  return home_url(); }
add_filter( 'login_headerurl', 'mb_login_url' );

// changing the alt text on the logo to show your site name
function mb_login_title() { return get_option( 'blogname' ); }
add_filter( 'login_headertitle', 'mb_login_title' );

Though if you're on a Network/MultiSite you might need network_home_url() instead

2
  • No problem, glad it worked!
    – MBL
    Mar 21, 2014 at 1:24
  • 1
    The filter login_headertitle is deprecated since WordPress 5.2.0, use login_headertext instead.
    – Sven
    Jul 5, 2021 at 7:54
0

You have to do is simply paste the codes below in your theme’s functions.php file:

  1. Custom Login URL :

    add_filter( 'login_headerurl', 'codecanal_loginlogo_url' );
    function codecanal_loginlogo_url($url) 
    {
      return 'http://www.codecanal.com'; 
      /* Put your desired custom URL here */ 
    } 
    
  2. Site URL :

    add_filter( 'login_headerurl', 'codecanal_loginlogo_url' ); 
    function codecanal_loginlogo_url($url) 
    {
      return home_url(); 
      /* User will be redirected to the site home page */
    } 
    

For more detail visit following blog : http://www.codecanal.com/change-login-logo-url-wordpress/

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.