Ever wished you had more errors? No? Of course you don't.
Unfortunately in WordPress these are inevitable. Although very, very, very stable... you do need to update WordPress and the plugins/themes quite often, especially with the recent exposed vulnerabilities.
And when you do, your users and visitors will see an error message.
Or what about migration of your database, or with the awesome Multi-DB plugin it might so occur that one of your servers go offline, this leaves a "error establishing a database connection" message for your user.
And you aren't informed about this!
Or the user has recently deleted his blog, why not inform your users that they can undo this.. or better yet: leave a message to where they can sign up!
Or you've marked a blog as spam.. unfortunately. With Anti-Splog this message will be created for you. But what if you don't use Anti-Splog?
I can elaborate much more... but it all comes down to this:
I'm a good webmaster and I want to look professional.
So what do you do? You brand that stuff!
Just look at the awesome screenshots below :smiley:
Now you can do that too, for free :smiley:
WordPress has some awesome stuff built into its core, dig deeper: https://core.trac.wordpress.org/browser/tags/4.2.2/src/wp-includes/load.php#L0
Here you'll see the error messages for when your site is updating plugins or themes.
You can overwrite these!
- blog-deleted.php - For when a user deletes his blog
- blog-inactive.php - For when a user hasn't activated his blog
- blog-suspended.php - For when a blog has been marked as spam
- db-error.php - For when hell breaks loose (or a database connection failed)
- maintenance.php - For when you update your WPcore/themes/plugins
What I've done for you:
I created these files beforehand, with the right error codes and messages.
I also set up a nice countdown script for when your user encounters the update message and an auto-reload in the header (15 seconds).
I also set up a lovely error handling script for you in db-error.php, read more below.
I can't say much about this, it speaks for itself. This only occurs when a non-super-admin deletes his or her blog.
The blog hasn't been activated yet after the signup process.
WPMUdev's Anti-Splog has already created this for you if you use it. Leave it alone if you use Anti-Splog and don't overwrite it.
However, if you don't use Anti-Splog, this will page can be safely uploaded and will tell the user his/her blog has been marked as spam.
A lovely way to tell your users you're undergoing updates/maintenance. It will also refresh the page (and thus redirect them to where they wanted to go) within 15 seconds. They could also spam the big blue button to do so (or hold F5).
This will also throw a 503 error to tell Google to not index the page and retry in 10 minutes.
Now this is something I loved working on. Pure PHP without WordPress goodies.
This page tells the users that there has been an error connecting to your database. Especially useful if you use WPMUdev's awesome, yes AWESOME, Multi-DB plugin where you split your databases (and errors are more likely if you use VIP or multiple servers).
This file will also create a logfile in /wp-content/dberror/ AND send you a mail whenever this happens (max once daily).
It will also throw a 503 error and tell Google to retry in 1 hour.
503 errors are also useful if you use an uptime checker like Pingdom or CA.
All files contain basic styling (got from the login page) and basic text.
Be sure to update these texts according to your site's needs. This isn't a plugin so I can't call those from your database.
Also update the e-mail address in db-error.php
- Edit the files to your liking.
- Open FTP and connect to your server. Go to /wp-content/
- Check if blog-suspended.php is already there.. if so you might use WPMUdev's AntiSplog
- If you use AntiSplog, it's better kept untouched
- Upload the rest of the files :slight_smile:. And blog-suspended too if you don't use Anti-Splog.
How to test it for looks?
- Simply open any site of yours in the network
- Go to: example.com/wp-content/db-error.php
- Check your e-mail inbox to see if you got the mail :slight_smile:, if not.. change the e-mail in the file
- Go to: example.com/wp-content/maintenance.php
- Go to: example.com/wp-content/blog-deleted.php
- Go to: example.com/wp-content/blog-inactive.php
- Go to: example.com/wp-content/blog-suspended.php
- All looks good? Good.
Screenshots below of how they look (in Dutch) :slight_smile: The first one is my login page, from which I took the styling. I'll upload an equivalent look for that later on for you to style :slight_smile:
But I don't use Multisite....
That's OK! db-error.php and maintenance.php are still useful :smiley:
Comments? Suggestions? Leave them below :smiley: