Create Custom WordPress Database Error Pages

The urgent WordPress 2.3.2 security release enables you to create a custom wordpress database error page, which will be displayed when wordpress has a problem connecting to your database, instead of garbled php coded error messages.

You need to Create a db-error.php file in any text editor like Notepad, fill in the appropriate html code and place it in the wp-content directory such that its location will be wp-content/db-error.php.

Now whenever you are upgrading wordpress and this file lies in wp-content folder (which is untouched during wordpress upgrades), you can display any custom message you want informing your visitors about the issue and they can check back soon. It is also useful at times when your web hosting provider is having database errors on their server and your wordpress is unable to connect to the database.

db-error.php file

I checked that the latest version 2.3.2 does not have this file installed in wp-content by default. So you need to create it and place it there. Here is the simplest code you can cut and paste in a blank Notepad file and save as db-error.php and FTP it under under wp-content

<title>Database Error Page</title>
The blog is unavailable due wordpress database connection issues. Please check back soon.

You can make it look more professional by blending with your CSS file, add your blog logo, RSS feed link, independent html pages (not connected to the database), sitemeter site traffic tracker and so on… a much appreciated feature.

Share with friends

About the Author: P Chandra is editor of QOT, one of India's earliest tech bloggers since 2004. A tech enthusiast with expertise in coding, WordPress, web tools, SEO and DIY hacks.