I'd like to change the title of my Wordpress logout screen.
I plan to use a filter on 'wp_login_errors' to change the body text but I don't know how to change the page title from "Wordpress Failure Notice".
First of all, if you see this page it means you're doing logout in a wrong way. The check_admin_referer()
fails and calls wp_nonce_ays()
, thus prompting for a confirmation (ays = Are You Sure?). See these threads for more details:
Finding and eliminating the cause of the problem may be the best way to go.
The text string itself is on line 2607 of wp-includes/functions.php:
wp_die( $html, __( 'WordPress Failure Notice' ), 403 );
As you see, there's no filter. However, it's a string passed to __()
function, which means you can filter it using gettext
:
function wpse283987_change_string( $translated_text, $untranslated_text ) {
global $pagenow;
if( $pagenow === 'wp-login.php' && $untranslated_text === 'WordPress Failure Notice' ) {
return __( 'Your New Text' );
}
return $translated_text;
}
add_filter( 'gettext', 'wpse283987_change_string', 20, 2 );