Wordpress has a cool plugin system that allows for various template changes. Sometimes, though, some defaults are planted in the program that require hacking the code to remove. By creating your own 404.php template and storing in the template are you can have it match the design of the rest of your blog, but what about if there is a database error?

These messages seem (?) to require the direct editing of wp-db.php and in particular the following functions inside that Wordpress script file:

function wpdb($dbuser,$dbpassword,$dbname,$dbhost)
function select($db)
function bail($message)

The top/bottom header and CSS portion is handled in the bail() function. The wpdb() function handles whether a connection can be made to the server or not and the select() function determines if it is possible to connect to the database table.

If there is a plugin filter which allows direct hacking of wp-db.php please use the comments or trackback to tell me about it. I looked through the codex at the various filters but didn’t see one that handled this part of Wordpress. This information was accurate as of version 1.5.2, future versions might make these database error messages allow user-defined templating.