Bug fix
Yesterday WordPress version 2.3.2 was released, chiefly to fix a bug that allowed any visitor to your site to view any posts set to be published in the future (a request like http://pressedwords.com/?x=wp-admin/&paged=1
would do it).
Suppress Error Messages
More generally, WordPress now suppresses most database error messages. That’s great for a production site, where you don’t want the public to see the kind of things that can be exposed in a MySQL error message. However, if you’re working on a development site, you might want to see those error messages. In that case, just put the following line in your development site’s wp-config.php
file:
define('WP_DEBUG', true);
Custom Database Error Page
2.3.2 includes a new feature: you can have a custom database error message page. Hopefully many sites will take advantage of this, so when they get slashdotted or dugg and their database servers go down, their visitors won’t blame WordPress (the default error page features the WordPress logo prominently).
It took me about 2 minutes to create my custom error page, which you can see above, by following these steps:
Creating a Custom WordPress Database Error Page
- Save the HTML from one of your posts, perhaps by viewing the source of the page in your browser and saving it. Or you can use
wget
. - Edit the saved file to remove extra stuff such as links to previous and next posts, the sidebar, and the comments section.
- Put the following code where your post’s content would normally go:
<?php global $wpdb; if ( ! empty($wpdb->error) ) echo $wpdb->error; ?>
- Rename the file to
db-error.php
. - Upload
db-error.php
to the/wp-content/
directory.
Upgrading
Upgrading WordPress from version 2.3.1 should be painless, as there were no changes to the database structure. Download the latest version of WordPress here.