In the last post of this series, we talked about what page templates should be available in themes. A few people mentioned 404 templates, but those aren’t page templates at all.
A 404 page is what a user sees when they come across a page that doesn’t exist on your site. Maybe you’ve moved it or deleted it. Maybe the user typed the address wrong.
You can also read the WordPress Codex article on creating an error 404 page.
What will usually happen when a user comes across a 404 page is that they’ll hit their browser’s back button almost immediately, this is especially true of users coming from search engines or a link from another site.
What we want to happen is for the user to stick around even if they didn’t find what they were looking for.
What should be included in the 404 template?
Most themes should have a 404 template. It’ll be named
404.php and located within your theme files.
The bad thing about these templates is that they probably don’t do much for your site. Even the WordPress Default theme only shows this:
Error 404 – Not Found
That’s not very helpful, now is it? I imagine most themes don’t alter this much.
You’ll probably want to modify whatever 404 comes packaged with a theme to suit your site’s needs, but maybe you already have some things in mind that should be included already.
What I’d like to hear from you is what you think should be included by default. Are there plugins that should be supported? Should it be widgetized? Should it list all posts? Archives? Categories?