Searched for awhile and looked at the codex https://developer.wordpress.org/reference/hooks/gettext - still cant find an answer.

The below function works perfectly when you are on the reset password page. There is only text to replace.

function my_gettext_filter( $translations, $text, $domain ) {
if ( ( $text == 'Please enter your username or email address. You will receive an email message with instructions on how to reset your password.' ) ) {
$translations = '<span style="font-weight:bold;">' . $translations . '</span>';
return $translations;
add_filter( 'gettext', 'my_gettext_filter', 10, 3 );

But...when I try and use the same function on the page that follows which says "Check your email for the confirmation link, then visit the login page." It doesnt work because login page text is inside anchor tags so it doesnt find an exact match. Does anybody know a way around this?

  • 2
    You will need to check the source where the text is originally defined to know what to replace. Translatable text must be static, so dynamic elements like the login URL will usually be placeholders in the translatable string. Jan 26 at 1:38


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.