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?

Yeah I think that 404 pages should try to keep the visitor on the website, with a search function, maybe top posts or cateogories. And also what J Mehmett was mentioning about the url guessing script, Google has a sort of plugin with their website managment tools that you put onto a 404 page. When someone mistypes a url say, it will try to suggest the proper url based on its search index for your site.

Well, IMO, the first thing you have to do is avoiding 404 errors. There is a nice Redirection plugin which can help you doing so. (p.ex. It automatically adds a 301 redirection when a post’s URL changes)

But when a vistitors lands on a 404 page from a search engine, it seems interesting to me to use the (Google / Yahoo) search query they used on an internal wordpress search and return the 3 most relevant results below the words “Maybe you were looking for this?”. Joost de Valk wrote an interesting article about improving your wordpress search results btw.

Also a very short but clear message why they are getting this 404 page is essential to keep people on your site. If things really look like a big error page it’s more than obvious that visitors start running away again.

It would, in my opinion, be a great addition to a theme if there was some easy way built-in to edit the 404 page. The default page in WordPress, and most themes, is pretty well useless.

I’ve changed mine so that it has a somewhat more helpful message, links to various archives, my contact page, and my standard blog sidebar. One other thing I would like to include, but haven’t been able to get working, is a searchbox in the main text — there is one in the sidebar though. I’ve also included a jokey picture, which is really corny, but I like it.

Most of what I’ve put in wouldn’t be out of place on the majority of sites, and so could be built into a theme as standard. But, if nothing else, an easy way to add what you want without having to directly edit php files (which is why I wondered about it for page templates) would be a real help.

Many websites use redirection when 404 error returns. So the mistyped URL will get back to the main index (home page) and I think this is the worst 404 ever. The user will confuse retrying the same URL, so its nice to tell the visitor that what s/he is looking for was either removed or never existed.

@Jylan Wynne,

Yea. The guessing script is pretty nice and will make all the possible efforts to keep the visitor on site. 😛

I have found it useful to include a sitemap on a 404. For me, if I cannot find what I am looking for because it has been moved, I like having the option of looking at all of the pages and posts in the site right there on the 404 error page.

An example would be: http://www.aleeya.net/whatever
(which doesnt exist) it tells you that the page is not found and gives you an option to look at the sitemap to see what is there.

Though I like the idea of the 404 error page guessing, I can not seem to locate what I thought was a plugin for that which I saw.

Also, for search engines, it is nice to have the internal links to other pages for a search engine to see if the page has been moved, etc. I have read a lot of positive things about that and SEO

erica stjohn
I’m thinking some sort of site map might work, but at the same time, I wouldn’t want to overwhelm the visitor with too much. Maybe a site map of the pages only would work best with the added benefit of the guessing plugin.

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution.

Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.