Create a Custom Error Page for "Error establishing a database connection"

Error establishing a database connection

Here’s how to make a custom database error page for WordPress.

If your site’s all set up and you see “Error establishing a database connection,” that’s an immediate “oh crap” situation., the company that hosts this website, has had some issues recently, and I’ve seen that screen a little too often.

If you want to define a custom “Error establishing a database connection” screen, add a file to your /wp-content/ folder named db-error.php. That will be loaded instead of that stupid message. Check out’s db-error.php.

A Good Idea for SEO

If you want to prevent search engines from indexing your site while it’s down, add <meta name="robots" content="noindex, nofollow" /> to your page’s `<head>`.¬†You sure don’t want Google caching your error! Continue reading “Create a Custom Error Page for "Error establishing a database connection"”