login_headerurl

Home » Hooks » login_headerurl

The "login_headerurl" hook is a WordPress action hook that allows developers to modify the URL that is linked to the logo on the login page. By default, this URL is set to the WordPress website’s homepage URL. However, using this hook, you can change the URL to redirect users to a specific page or external website.

This hook is primarily used when you want to customize the login page for your WordPress site. For example, if you have a separate custom login page, you can use the "login_headerurl" hook to change the URL of the logo to point to that custom login page instead of the homepage. This ensures a consistent branding experience for your users.

Here’s an example usage code of the "login_headerurl" hook:

function custom_login_logo_url() {
    return 'https://example.com/custom-login-page';
}
add_filter( 'login_headerurl', 'custom_login_logo_url' );

In this example, the "custom_login_logo_url" function is defined to return the URL of a custom login page. By using the "add_filter" function with the "login_headerurl" hook, we attach our custom function to modify the URL linked to the logo on the login page. Now, when users click on the logo, they will be redirected to the "https://example.com/custom-login-page" URL instead of the homepage URL.

Using the "login_headerurl" hook, you can easily personalize the login experience for your WordPress website and direct users to a specific page or external site of your choice.

Learn More on WordPress.org

WordPress snippets using the login_headerurl hook

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