What's with all the pink?

Find out more at Pink for October or get your own Pink!

5ThirtyOne

Avatar

A blog. A website. A semi-coherent receptacle for Derek Punsalan mixed with excerpts of technology, personal interests, and noteworthy items.

Twitter: Saigon nightlife... inter-est-ing. Squared, Lush, and Gossip.
Get content delivered: RSS | Email

Derek Punsalan...is Sylvia Loh MyQuire - Get stuff done with people who share your passions Box.net - Access your files anywhere with Box

Current » This post published on February 11th 2008 at 11:07 pm

WordPress 2.3+ official support for custom database error page

Some time ago a tutorial was posted on 5ThirtyOne which addressed customizing the DB Error page rendered whenever visitors landed on heavily trafficked WordPress site. Since then, the method has been proven "useless", ushered away by recent updates to the WordPress code base; more specifically with the release of WordPress 2.3.2 (current release is 2.3.3). Whereas the previous method required manipulating code within a core WordPress file, the new updated method allows for the custom page to be stored externally of the WP root directory. To get started creating your own custom WordPress database error page, follow the two steps below:

Create a db-error.php file in /wp-content/

First things first. Create an XHTML file called db-error.php and upload it to the WordPress /wp-content/ directory.

DB Error file in Transmit

Because visitors will see this page when your WordPress driven website is experiencing database connection errors, you will need to make sure the file includes any style attributes inline, or reference an external stylesheet (absolute URL).

<style type="text/css">...your CSS goes here...</style>

or

<link href="http://url.com/my-stylesheet.css" rel="stylesheet" type="text/css">

For the sake of simplicity, we’ll create a custom database error page with a single XHTML document including any style attributes inside the <head> tags. The following is the message skeleton originally created and used in the tutorial here.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<title>My server crashed, please call the next of kin</title>
<style type="text/css">
body {
font-family: arial, verdana, sans-serif;
font-size: 62.5%;
background: #fff;
color: #333;
text-align: center;
}
a {
text-decoration: none;
outline: none;
}
#error_wrapper {
font-size: 1.3em;
margin: 5em auto 0;
text-align: left;
width: 333px;
}
.content_wrapper {
padding: 1em 0.7em 0;
}
</style>
</head>
<body>
<div id="error_wrapper">
<div class="content_wrapper">
<p>It looks as though my server has taken an unsupervised leave of absence. I may not know of its whereabouts so would you be so kind as to notify me via <a href="mailto:admin@domain.com" title="Send me an email">email</a>?</p>
</div>
</div>
</body>
</html>

Second step, there is none

If you created a standard XHTML document and dropped the code in db-error.php inside the /wp-content directory, there really isn’t anything else to do other than to ensure that your site visitors never see a WordPress database error page while visiting your site.


Explore » Discover new content on 5thirtyone.com

This post tagged , , , , . Explore similarly tagged content below or visit a random entry. Visit the archives for additional content.

Meta » Gritty post related bits

The post titled WordPress 2.3+ official support for custom database error page is categorized under WordPress. Feel free to leave a comment or trackback from your own site.

Advertisement

Reader Activity: Have something to say about WordPress 2.3+ official support for custom database error page?
6 Comments
  1. That’s pretty cool. Of course, those who are uninformed will just blame you for having crappy hosting and using Wordpress anyway. But it’ll still be cool to have a different kind of error than the usual. Another way to remind people of you :D

  2. Now that’s handy; I didn’t even know the error DB page was essentially hard-coded into the WordPress core (and, therefore, a clean slate at every update).

    Now I just need the traffic with which to bring my database to it’s knees, and to give my DB error page a chance to show itself to the world!

  3. Every time I come here, I am learning something new, thanks Derek.

Leave a Reply

Your comment may be held for moderation. If your comment is not displayed immediately, do not repost. I reserve the right to remove any and all comments deemed as personal attacks or completely off-topic. Please use the appropriate discussions forum if your comment is not applicable to the current article.

Archived: Browse previous activity by category
Browse an overview of recent activity

View Tutorials » Step-by-step go make something tutorials

WordPress Custom Fields; laying text over your lead graphic

For WordPress users, there are certain scenarios when the typical reverse chronological presentation of content is just not enough. I have experimented with different methods ...

Remove DRM protection from iTunes tracks with iMovie HD

A few days back I found myself perusing the iTunes Music Store looking for a few songs that I had heard via Sirius*. After completing ...

View Apple » Apple software & hardware related articles

"What you’ll find in my Leopard"… and what you won’t

I had made plans for a proper break-down concerning the features, changes, and updates for Apple's latest feline incarnation - 10.5 Leopard. Ultimately, I decided ...

How-to: Proper Gmail IMAP for iPhone & Apple Mail

UPDATE 11/18: inaequitas reminds us that in order to star messages on your iPhone, simply move the message the starred items directory. UPDATE 10/26: RayL re-confirms ...

View Personal » Personal thoughts & rants

Planning on carrying the momentum, 2007 to 2008

Syl caught a photo of Boo (Mini Rat Terrier) in a rare "not bouncing off the wall and couch" mode The later part of 2007 was ...

November is purple, Pancreatic Cancer Awareness

Educate and promote awareness Last month 5ThirtyOne went pink to support Pink for October raising awareness for Breast Cancer Awareness Month. A co-workers partner raised the ...

View Inspiration » Design related announcements & articles

Lovely Blogs highlights "blog design"

Ben Bleikamp, also known for his entrepreneurship blog College Startup, has been hard at work coding and compiling his design community share Lovely Blogs. Now ...

Rebooted - “Fat” faux footers

Inspired by Phu's Many colours of a reboot, I've decided to share my favorite sites which utilize "fat" footers. I think the more appropriate title ...

View Mobile » Mobile technology & information

Asus Eee PC sub-notebook running Apple OS X

Ignoring the legalities or hair pulling from Apple's legal department, Dan decided that it was high time for a sub-notebook running OS X. If Apple ...

Unlimited SMS savings for iPhone (or any phone) family account holders

There are currently three different iPhone plan add-ons for at&t family accounts. Each plan offers unlimited data usage & visual voicemail. The only difference which ...

View Noteworthy » Take note, noteworthy posts or news

Maybe shopping in person actually does save time?

Yesterday I was hoping to have some free time to visit the grocery store to pick-up a few necessities. Unfortunately, I realized all too late ...

Warning! Gmail users beware, fake upgrade emails

UPDATE: According to a comment on digg, gmailupgrades.com has been taken down. Important FYI update for any Gmail users. If you receive the following email in ...

View Productivity » Staying productive, articles pertaining to productivity

Box.net evolves, say hello to OpenBox

Box, a long-time favorite mentioned in Box.net as a collaborative file manager, has evolved into OpenBox adding new features which would tie the service into ...

Basecamp, activeCollab, and Goplan compared

UPDATE 11/18: activeCollab is no longer offered as a free project management collaboration download. From the design, development, and product strategy company Webreakstuff comes a new ...

View WordPress » Articles pertaining to the rock solid CMS WordPress

The Unstandard WordPress theme

The Unstandard WordPress theme is released / shared with the intent of breaking the typical blog mold. Farewell to the blase reverse chronological text heavy ...

WordPress 2.3+ official support for custom database error page

Some time ago a tutorial was posted on 5ThirtyOne which addressed customizing the DB Error page rendered whenever visitors landed on heavily trafficked WordPress site. ...

Advertisement



External: Your reader says "feed me"
Finished? Return to the top

Flickr » Subscribe to my Flickr

  • Coconut juice
  • Dried fish
  • Fresh crabs
  • Fresh frogs
  • Rooftops
  • Vietnam Airlines