How to Change the Login Logo URL in WordPress

Home » Snippets » How to Change the Login Logo URL in WordPress
0

Created with:

Visibility: 

public

Creator: WPTurbo Team

Customize with WPTurbo AI
X

Add Snippet To Project

New Project
Add To Existing Project

Have you ever wanted to change the default login logo URL in WordPress? By default, when users click on the login logo on the WordPress login page, they are directed to the WordPress.org website. However, you may have a specific website or external link in mind that you want to redirect your users to. In this article, we’ll show you how to change the login logo URL in WordPress, allowing you to customize the link to fit your needs.

					function wpturbo_change_login_logo_url() {
    return home_url();
}
add_filter( 'login_headerurl', 'wpturbo_change_login_logo_url' );
				

The code snippet provided allows you to change the login logo URL in WordPress. By default, the logo URL redirects to the site homepage. However, with this snippet, you can modify the URL to redirect to a custom location.

To achieve this, we define a new function called wpturbo_change_login_logo_url(). Inside this function, we use the home_url() function provided by WordPress to retrieve the URL of the site’s homepage.

function wpturbo_change_login_logo_url() {
    return home_url();
}

The home_url() function returns the URL of the site’s homepage as set in the WordPress settings. By returning this value within our function, we ensure that the login logo URL is dynamically generated and always points to the correct homepage URL.

Once we have defined our function, we need to hook it into the login_headerurl filter. This filter is responsible for rendering the URL of the login logo. By adding our custom function using the add_filter() function, we tell WordPress to use our function to modify the default login logo URL.

add_filter( 'login_headerurl', 'wpturbo_change_login_logo_url' );

With this code in place, the login logo URL will now be dynamically generated based on the site’s homepage URL. This allows you to easily change and customize the login logo URL for your WordPress website.

Register an account to save your snippets or go Pro to get more features.