You are here: / Articles / Guides / Tips / How to Change the Database Error Page in WordPress

How to Change the Database Error Page in WordPress

Database Error Page

Share!



WordPress is this great piece of software for creating great websites but like many great things, they also leave a lot to be desired when it comes to certain things and one of them is the database error page.

WordPress is an open source web application software for developing websites, blogs and web applications that has had a lot of work put in by the development team and community at large.

There are some aspects of the application that have not gotten as much attention for one reason or another. One of these is how the application handles database and other server errors.

WordPress handles this by putting out a simple one line message in boring, or should we say ugly text printing out the issue. One may argue that the text message though informative can be a security risk depending on how you choose to look at it.

Read Also  Demystifying C++ Templates for Beginner Programmers

Database Error

Furthermore it breaks the consistency in the look and feel of your website’s brand which obviously has has a lot of thought and work and put into it. So how do we fix the problem? Well it is quite simple to do as you will below.

Customizing the Database Error Page

The first thing is obviously you need to have access to the WordPress directories. Inside the /wp-content/ folder, you need to create or upload a file named “db-error.php“. Whenever WordPress has a database issue and finds that file, It will actually process that file accordingly.

In that file is where you can customize your HTML and CSS to match your website theme. You can also change the message to something that is more exciting than the default. The other things that would be nice to have in that file is some headers to let your browser know what is going on and probably retry the link and even send out an email to the website administrator to let them know something is a miss.

Below is a template that you can use to get started with your customizing the Database error page.