Developers

Change or Remove Login Logo Link

WordPress, by default, displays its logo on the login page, and this logo links to the official WordPress website. However, you might want to customize this link to redirect to your website’s homepage or another specific page.

This tutorial will guide you through the process of changing the link on the login page logo using hooks. We’ll also cover how to change the alt text of the logo to display your site’s name.

Accessing the Theme’s Functions File

First, you need to access your theme’s functions.php file. This file allows you to add custom PHP code to your theme.

Via WordPress Admin Dashboard:

  • Navigate to Appearance > Theme Editor.
  • In the Theme Files list on the right, find and click on functions.php.

Via FTP or File Manager:

  • Use an FTP client or your web host’s file manager to navigate to wp-content/themes/your-theme/.
  • Open the functions.php file for editing.

To change the link of the login page logo from WordPress.org to your site’s homepage, you need to use the login_headerurl filter. Add the following code to your functions.php file:

// Changing the logo link from wordpress.org to your site
function mb_login_url() {
    return home_url();
}

add_filter('login_headerurl', 'mb_login_url');

Or, if you want to remove the link:

add_filter('login_headerurl', '__return_false');

Explanation:

  • mb_login_url: This function returns the URL of your site’s homepage using the home_url() function.

Changing the Logo Alt Text

Next, to change the alt text of the login page logo to display your site’s name, use the login_headertitle filter. Add the following code to your functions.php file:

// 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');

Explanation:

  • mb_login_title: This function returns the site name by retrieving the blogname option from your site’s settings.

Save Changes

After adding the above code to your functions.php file, save the changes. If you are using the Theme Editor, click the Update File button. If you are using an FTP client or file manager, upload the modified functions.php file back to your server.

Verify Changes

To ensure that the changes have been applied correctly:

  1. Log out of your WordPress admin dashboard.
  2. Navigate to your login page (typically found at yourdomain.com/wp-login.php).

Additional Tips

Custom Login Page Plugins: Consider using a custom login page plugin for more extensive customizations. Plugins like LoginPress offer a user-friendly interface for modifying the login page.

John Darrel

Change Database Prefix in WordPress

Because hackers often use bots to search for security flaws in your website, it is…

12 months

Customize WordPress Uploads Directory

The easiest way to change the default media uploads path is to use the WP…

12 months

WP Ghost and WP Rocket Cache

To hide all CSS and JS you need to follow the steps to Combine the…

12 months

Why is website security important?

https://youtu.be/6ylhojSi-_E In this video, we’ll explore why website security matters and what can happen if…

12 months

Is WordPress Website Easily Hacked?

The security of your WordPress site depends on multiple factors, such as the strength of…

12 months

Setting up Two-Factor Authentication (2FA) for WordPress Using Mobile Apps

When you enable two-factor authentication (2FA) for your WordPress website, it adds an extra layer…

12 months