Changing and removing WordPress login and admin bar logo

WordPress is my goto platform for when I want need to create a simple site where I want to user to have full control of the site and make updates if needed. They may be times when you don’t want to show the site is powered by wordpress. I’m going to show how to remove references from the wordpress logo from the admin bar and change the wordpress login logo.

Changing and removing WordPress login and admin bar logo

Add the following code snippet below into your functions.php file in your current theme.

Change the WordPress Login Logo

Replace the PATHLOGO with the logo in which you want to use.

// ---------------------------------
// Change the WordPress Login Logo
// ---------------------------------
function change_login_logo() {
       echo '<style type="text/css">
           h1 a { background-image:url(PATHTOLOGO) !important; }
        </style>';
}

add_action('login_head', 'change_login_logo');

Change the WordPress Login Logo url and title tag

This replaces the title tag and url with the WordPress Url and Sitename. If you want to use a another value just replace it with the following return ‘MY TEXT’

// ---------------------------------
// Change WordPress Login Logo title text and url
// ---------------------------------
function change_login_logo_title(){
    return get_bloginfo('name');
}

add_filter('login_headertitle', 'change_login_logo_title');

function change_login_logo_url(){
    return get_bloginfo('url');
}

add_filter('login_headerurl', 'change_login_logo_url');

Remove WordPress logo from the admin bar

This snippet remove the WordPress logo from the navbar in the header. When the user is aigned into wordpress

// ---------------------------------
// Remove WordPress logo from the admin bar
// ---------------------------------
function remove_wp_admin_logo( $wp_admin_bar ) {
    $wp_admin_bar->remove_node('wp-logo');
}

add_action('admin_bar_menu', 'remove_wp_admin_logo', 999);

Leave a Reply

Your email address will not be published. Required fields are marked *