How to Customize “WordPress > Error” Text in Titlebar?

When a user doesn’t enter all required things in comment box area and click on submit comment button, a new page is shown telling user that some required fields are missing such as name, email, etc.

The page contains "WordPress > Error" text in titlebar.

Read More

I want to replace this text with my custom text.

I have been doing this by manually replacing following line in wp-includesfunctions.php file:

$title = $have_gettext ? __('WordPress › Error') : 'WordPress › Error';

Now I don’t want to edit core file. I want to know if it is possible to do the same thing by using my blog theme’s functions.php file?

Related posts

1 comment

  1. Changing interface string is often done using gettext translation filter, but I was in the mood for something different so creatively mangled die handler to achieve it:

    add_filter( 'wp_die_handler', function () {
    
        if ( false !== strpos( $_SERVER['SCRIPT_NAME'], 'wp-comments-post.php' ) ) {
            return function ( $message, $title, $args ) {
                _default_wp_die_handler( $message, 'Our Custom Title', $args );
            };
        }
    
        return '_default_wp_die_handler';
    } );
    

Comments are closed.