When this happens, if you’re familiar with the site and trust it, maybe you’ll spend the extra time and energy to search for the content you were looking for, hoping it might have just been moved somewhere else. But if you’re like most, you’ll simply go away.
Your Theme’s 404 Page
Most themes these days come with a 404.php page. This page typically says something like, “Sorry, but that page can’t be found.”
The better themes will try to minimize the damage of a visitor finding a 404 page by trying to lead them to other content. They may provide a search box (which is useful) and possibly a list of recent posts and even a list of your categories.
All that’s good, and certainly much better than a generic 404 page (or no 404 page). But there’s something even better than “other content.” How about RELATED CONTENT?
After all, if your visitor is looking for info on green bananas, but your latest posts are about winter coats, they will back out of your site without thinking twice.
Enter the Smart 404 plugin.
This plugin can help your visitor easily find the content he/she was originally looking for or similar content. It does this by using the keywords from the URL the visitor landed on and then searching your posts, pages, tags, and categories.
So, for example, say the 404 page landed on was www.example.com/green-bananas-all-the info-you-need.
The plugin will recognize “green bananas” and return content related to it.
HOW IT WORKS
After installing and activating the plugin, you can choose what you would like it to search to retrieve the related posts.
You will also need to insert a little bit of code into the 404.php file in your theme. (Appearance >> Editor >> 404.php)
The code you insert will depend on what you’d like to show.
For example, if you’d like to show only the titles of related posts, you will insert the following wherever you’d like them to show up:
<?php smart404_suggestions() ?>
However, this plugin can be even more sophisticated than that. You can also instruct the plugin display a list of excepts from the related posts. Insert the following:
<?php smart404_loop(); ?>
<?php while (have_posts()) : the_post(); ?>
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
<?php endwhile; ?>
All this info can be found on the plugin page at WordPress.org.
(Note: You might want to take out some of the extra info your theme’s 404 page contains after adding the Smart 404 info.)
TIP – Give the Visitor a Simple Call to Action
I recently installed this plugin on a site and customized the message above it to say something like:
Sorry, but that page isn’t here.
Please check the posts below.
Below that I have the Smart 404 plugin provide a list of excerpted posts that are related to what they were searching for.
I had to tell visitors that the page they were looking for had either disappeared or was moved, but knowing that web surfers are impatient, I didn’t want to mess around with much more than that. So then I told them (in bold) to check the posts below (implying that it might be there … and it might be, of course).
If the post they are looking for isn’t there, they are still MUCH more likely to find something close to what they were looking for in the first place and are therefore MUCH more likely to then stick around.
Thanks to MattHurst for the image.