Home » Wordpress » How to Create a Custom Database Error Page in WordPress

Paste the code below into a new file. Name it db-error.php and save it on your wp-content directory. In case of a database error, WordPress will automatically use this file.

<?php // custom WordPress database error page tutorial @ santoshkori.com

	header('HTTP/1.1 503 Service Temporarily Unavailable');
	header('Status: 503 Service Temporarily Unavailable');
	header('Retry-After: 3600'); // 1 hour = 3600 seconds
	mail("mail@santoshkori.com", "Database Error", "There is a problem with teh database!", "From: SantoshKori's Blog");


<html style="height:100%;">
<title>Database Error</title>
body { padding: 20px; background:#fff; color: #999; font-family: arial; text-align:center  }
<body style="height:100%;">
  <h1>Captain, the ship can&rsquo;t take much more of this!</h1>
  <p>SantoshKori's Blog is currently experiencing technical issues &mdash; Please check back soon!</p>
  <P>Mail me at <a href="mailto:mail@santoshkori.com">mail@santoshkori.com</a>
  <img src="http://santoshkori.com/blog/wp-content/uploads/2010/10/freelancer-webdesigner-mumbai-india.jpg" style="position:fixed; bottom:5%; right:2%;">

Simple, yes, but more effective than the default error page at facilitating a rapid response. Again, because this is a regular PHP file, we can do just about anything with it — more functionality, elaborate design, etc

Here’s an example of the code you could use for this page (see the final output here):

Incoming search terms:

Leave a comment


Leave a Reply

[ Ctrl + Enter ]


Wordpress Freelancer, Joomla Freelancer Web designer Mumbai india, Wordpress web developer India, Joomla Web developer india, Outsourcing web project india mumbai

By Santosh Kori Published: October 10, 2012 Professional Freelance Website developer 5 stars based on 65 reviews Total time: 24 hour 00 min Wordpress Joomla XHTML CSS jQuery HTML5 eCommerce CSS3 ☞ Offers low cost freelance web designing, asp php asp.net web development services from Mumbai India. Freelance web designer & developer Mumbai India.