{"id":541,"date":"2012-06-20T14:47:23","date_gmt":"2012-06-20T05:47:23","guid":{"rendered":"http:\/\/www.santoshkori.com\/blog\/?p=541"},"modified":"2012-08-23T17:25:22","modified_gmt":"2012-08-23T08:25:22","slug":"how-to-create-a-custom-database-error-page-in-wordpress","status":"publish","type":"post","link":"https:\/\/www.santoshkori.com\/blog\/how-to-create-a-custom-database-error-page-in-wordpress\/","title":{"rendered":"How to Create a Custom Database Error Page in WordPress"},"content":{"rendered":"<p>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.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\r\n&lt;?php \/\/ custom WordPress database error page tutorial @ santoshkori.com\r\n\r\n\theader('HTTP\/1.1 503 Service Temporarily Unavailable');\r\n\theader('Status: 503 Service Temporarily Unavailable');\r\n\theader('Retry-After: 3600'); \/\/ 1 hour = 3600 seconds\r\n\tmail(&quot;mail@santoshkori.com&quot;, &quot;Database Error&quot;, &quot;There is a problem with teh database!&quot;, &quot;From: SantoshKori's Blog&quot;);\r\n\r\n?&gt;\r\n\r\n&lt;!DOCTYPE HTML&gt;\r\n&lt;html style=&quot;height:100%;&quot;&gt;\r\n&lt;head&gt;\r\n&lt;title&gt;Database Error&lt;\/title&gt;\r\n&lt;style&gt;\r\nbody { padding: 20px; background:#fff; color: #999; font-family: arial; text-align:center  }\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body style=&quot;height:100%;&quot;&gt;\r\n  &lt;h1&gt;Captain, the ship can&amp;rsquo;t take much more of this!&lt;\/h1&gt;\r\n  &lt;p&gt;SantoshKori's Blog is currently experiencing technical issues &amp;mdash; Please check back soon!&lt;\/p&gt;\r\n  &lt;P&gt;Mail me at &lt;a href=&quot;mailto:mail@santoshkori.com&quot;&gt;mail@santoshkori.com&lt;\/a&gt;\r\n  &lt;img src=&quot;http:\/\/santoshkori.com\/blog\/wp-content\/uploads\/2010\/10\/freelancer-webdesigner-mumbai-india.jpg&quot; style=&quot;position:fixed; bottom:5%; right:2%;&quot;&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n\r\n<\/pre>\n<p>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 \u2014 more functionality, elaborate design, etc<\/p>\n<p>Here\u2019s an example of the code you could use for this page (<a href=\"https:\/\/www.santoshkori.com\/blog\/db-error.html\" target=\"_blank\">see the final output here<\/a>):<\/p>\n<h4>Incoming search terms:<\/h4><ul><li><a href=\"https:\/\/www.santoshkori.com\/blog\/how-to-create-a-custom-database-error-page-in-wordpress\/\" title=\"co in co in co in comwww\">co in co in co in comwww<\/a> (71)<\/li><li><a href=\"https:\/\/www.santoshkori.com\/blog\/how-to-create-a-custom-database-error-page-in-wordpress\/\" title=\"\/www \/\/\/\/ co in co in co in\">\/www \/\/\/\/ co in co in co in<\/a> (11)<\/li><\/ul>","protected":false},"excerpt":{"rendered":"<p>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. &lt;?php \/\/ custom WordPress database error page tutorial @ santoshkori.com header(&#8216;HTTP\/1.1 503 Service Temporarily Unavailable&#8217;); header(&#8216;Status: 503 Service Temporarily Unavailable&#8217;); header(&#8216;Retry-After: 3600&#8217;); \/\/ 1 hour [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,230,184],"tags":[247,334,246,342,337,338,336,339,321,341,340,335,322],"class_list":["post-541","post","type-post","status-publish","format-standard","hentry","category-wordpress","category-wordpress-seo","category-wordpress-tip-and-tricks","tag-custom-database-error-page-in-wordpress","tag-freelancer-wordpress","tag-how-to-create-a-custom-database-error-page-in-wordpress","tag-indian-wordpress-developer","tag-mumbai-wordpress-designer","tag-mumbai-wordpress-developer","tag-mumbai-wordpress-freelancer","tag-wordpress-designer-mumbai","tag-wordpress-developer","tag-wordpress-developer-india","tag-wordpress-developer-mumbai","tag-wordpress-freelancer-mumbai","tag-wordpress-theme-developer"],"_links":{"self":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/comments?post=541"}],"version-history":[{"count":7,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/541\/revisions"}],"predecessor-version":[{"id":546,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/541\/revisions\/546"}],"wp:attachment":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/media?parent=541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/categories?post=541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/tags?post=541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}