Using WordPress ‘login_headertitle’ PHP filter

This guide describes the usage of the deprecated WordPress PHP filter login_headertitle. This filter allows you to modify the title attribute of the header logo above the login form. It is recommended to use login_headertext instead.

Usage

add_filter('login_headertitle', 'your_custom_function');

function your_custom_function($login_header_title) {
  // your custom code here
  return $login_header_title;
}

Parameters

  • $login_header_title (string) – The original login header logo title attribute.

More information

See WordPress Developer Resources: login_headertitle (deprecated)

Examples

Change login header title

Update the login header title to “My Custom Login”.

add_filter('login_headertitle', 'change_login_header_title');

function change_login_header_title($login_header_title) {
  $login_header_title = 'My Custom Login';
  return $login_header_title;
}

Add website name to login header title

Append the website name to the login header title.

add_filter('login_headertitle', 'add_website_name_to_login_header_title');

function add_website_name_to_login_header_title($login_header_title) {
  $site_name = get_bloginfo('name');
  $login_header_title .= ' | ' . $site_name;
  return $login_header_title;
}

Localize login header title

Translate the login header title to the user’s locale.

add_filter('login_headertitle', 'localize_login_header_title');

function localize_login_header_title($login_header_title) {
  $localized_title = __('Login to our Website', 'text-domain');
  return $localized_title;
}

Add dynamic date to login header title

Include the current year in the login header title.

add_filter('login_headertitle', 'add_dynamic_date_to_login_header_title');

function add_dynamic_date_to_login_header_title($login_header_title) {
  $current_year = date('Y');
  $login_header_title .= ' (' . $current_year . ')';
  return $login_header_title;
}

Remove login header title

Remove the login header title completely.

add_filter('login_headertitle', 'remove_login_header_title');

function remove_login_header_title($login_header_title) {
  return '';
}