[wp-hackers] Change "Error Establishing a Database Connection" error message

Nicholas Ciske nl at thoughtrefinery.com
Tue Apr 15 17:39:00 UTC 2014

No filter, but the template can be overridden... and that could send an email.

// Load custom DB error template, if present.
if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
	require_once( WP_CONTENT_DIR . '/db-error.php' );

See line ~1388 here:

And dead_db() on line ~1955 here:

On multisite you can filter wp_die() to check for that message and alter it/send an email.

See line ~401 here:


Nick Ciske

On Apr 15, 2014, at 12:27 PM, Ryan B <cloudpresshosting at gmail.com> wrote:

> I am wanting to change this error message to something a little more useful
> to an end user, and also have it trigger an email alert to me if this error
> occurs. Is there a hook or filter I could use to change the output given to
> the user when a database connection error occurs?

More information about the wp-hackers mailing list