For wp-login.php, the default page title, as displayed in the browser tab, is "Log In".
I need to change this value using a filter in functions.php.
Every solution I've read addresses the header title but I need to modify the head title.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityFor wp-login.php, the default page title, as displayed in the browser tab, is "Log In".
I need to change this value using a filter in functions.php.
Every solution I've read addresses the header title but I need to modify the head title.
I don't see a filter in wp-login for the title, but it does use __()
so you might be able to use the gettext
filter like:
add_filter('gettext', 'wpse_214367_change_login_title', 20, 3);
function wpse_214367_change_login_title( $translated_text, $untranslated_text, $domain ) {
if( "Log In" == $untranslated_text )
$translated_text = "My New Title";
return $translated_text;
}
EDIT: Please try this and let me know if it works. May also need to add a check to make sure you are on wp-login.php page
add_filter('gettext', 'wpse_214367_change_login_title', 20, 3);
function wpse_214367_change_login_title( $translated_text, $untranslated_text, $domain ) {
static $count=0;
if( "Log In" == $untranslated_text AND $count === 0 ){
$translated_text = "My New Title";
$count++;
}
return $translated_text;
}