A 404 page (Page Not Found error message) is a page a user gets to see when they attempt to access a part of a website or WordPress blog that does not exist. Either the page has been (re)moved, the user clicked a broken link, or maybe they misspelled a word in the URL.
Often, a 404 page has nothing interesting to offer the user, causing them to just click away from the page again. This is a waste. Why not try and customize your 404 page in a way it invites them to look around your website or WordPress blog, or help them find what they were looking for?
What a custom 404 page should contain
The idea is to try and get the visitor to stay on your blog, here are some ways to try and achieve this.
- Make sure your 404 page has the same look & feel as the rest of your blog.
- Provide the visitor with a clear and friendly message explaining that the page they were looking for could not be found.
- Include a search box for the visitor, so that they can try and find the page they were looking for.
- Have some of your latest and/or most popular blog posts show up on the 404 page.
Where do I find the 404 page template in WordPress?
Your theme should come with a 404 template (404.php). You can either edit this file manually or edit it when logged into your WordPress dashboard as admin. (Appearance -> Editor).
How to display recent WordPress blog posts
To display a list of recent blog posts, you can use the following code:<ul id=”recentposts”>
<?php get_archives(‘postbypost’, ’15’, ‘html’, ”, ”, FALSE); ?>