Create Custom WordPress Database Error Pages

By Posted 2007 Updated   BloggingDomain HostingWordPress

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

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

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.


One comment on “Create Custom WordPress Database Error Pages

  1. jim says:

    I have created a db-error.php page by browsing to my 404 page, viewing the source file in the browser and saving this one as db-error.php.
    Then I have edited the file to show the right message and deleted some of the content.
    Now it looks very similar to a normal page.

Leave a Reply

Your email address will not be published. Required fields are marked *




css.php