• Skip to primary navigation
  • Skip to main content
  • Skip to footer
  • Books
    • Content Strategy for WordPress (2015)
    • WordPress for Web Developers (2013)
    • Beginning WordPress 3 (2010)
  • Blog
    • Content Modeling for WordPress
    • WordPress Hidden Gems
    • Web Design
  • Work
    • Presentations and Interviews
    • on GitHub →
    • MLIS Class Projects (2019-2022)
    • Portfolio (2002-2019)
    • WordPress Plugins

Stephanie Leary

Writer, Front End Developer, former WordPress consultant

  • About
    • Press Kit
    • Presentations and Interviews
  • Contact Me

WordPress Hidden Gems: Database Error Pages

September 23, 2010 Stephanie Leary 1 Comment

There are a few files that live outside the theme directory but still affect how your site looks at times. For example, you can create a file called db-error.php in your wp-content directory — not in themes! — and use it to style your database connection error message:

<html>
<head>
<title>Database Error | MySite.com</title>
</head>
<body>
<h1>Database Error</h1>
<p>The database is not responding, and this site is unavailable. We’re sorry! Please try again later.</p>
</body>
</html>

You can dress this up to match the rest of your site by copying the contents of your theme’s header.php, sidebar.php, and footer.php files into the appropriate locations, but remember to remove any WordPress-specific functions, since they won’t work if the database is unavailable. You can also link directly to the stylesheet in your theme directory; just remember to change the link if you switch themes.

If you’re building this error page for a business, offer the user a way to contact you by email or phone rather than just asking them to come back later. Your users will appreciate having some alternative ways to get things done.

Find all the WordPress Hidden Gems in [link id=”2675″]Beginning WordPress 3[/link].

WordPress

This is an excerpt from Content Strategy for WordPress.My latest books are Content Strategy for WordPress (2015) and WordPress for Web Developers (2013). Sign up to be notified when I have a new book for you.

Reader Interactions

Comments

  1. Ozh says

    September 24, 2010 at 8:54 am

    I’d also add a status_header( 500 ); to tell googlebot and such that the page is not at its normal state

    Reply

Leave a Reply Cancel reply

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

Footer

My Books

I’m a front end developer at Equinox OLI, working on open source library software. I was previously a freelance WordPress developer in higher education. You can get in touch here or on LinkedIn.

Copyright © 2025 Stephanie Leary · Contact