How to load custom database error template in 2 easy steps?

  • Step 1: create a file in the directory: wp-content/db-error.php
  • Step 2: now you can insert static html in this newly created template.

Benefit is, if something happens to your database server and you don’t want your visitors to know that database server is down, instead of displaying default WordPress error messages, you can show a page with message “Maintenance Mode” or redirect visitors to some another site or anything more suitable for your site visitors.

Learn about WordPress database object here: Understanding $wpdb

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.