How To Change or Remove Login Logo Link
June 6, 2024
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.
- 1. Accessing the Theme’s Functions File
- Via WordPress Admin Dashboard:
- Via FTP or File Manager:
- 2. Changing the Logo Link
- Explanation:
- 3. Changing the Logo Alt Text
- Explanation:
- 4. Save Changes
- 5. Verify Changes
- Additional Tips
1. 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.
2. Changing the Logo Link
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 thehome_url()
function.add_filter('login_headerurl', 'mb_login_url')
: This line applies themb_login_url
function to thelogin_headerurl
filter, changing the logo link.
3. 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 theblogname
option from your site’s settings.add_filter('login_headertitle', 'mb_login_title')
: This line applies themb_login_title
function to thelogin_headertitle
filter, changing the alt text of the logo.
4. 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.
5. Verify Changes
To ensure that the changes have been applied correctly:
- Log out of your WordPress admin dashboard.
- Navigate to your login page (typically found at
yourdomain.com/wp-login.php
). - Verify that the logo now links to your homepage and that the alt text displays your site’s name.
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.