WordPress includes a 404 error page template in the theme, however the contents of this are not editable in the backend of WordPress (within the CMS).
Placing the code below in your themes 404.php
file enables you to create a WordPress page using the slug of 404-error
and the content of this page will be displayed when user lands on your sites 404 page.
- The 404 page is often a page which is served a lot. Therefore you should keep it light and not have too many heavy queries taking place such as latest posts. Sticking to simply text and maybe an image is a good idea.
- As the 404 page is now a page in WordPress, you will probably want to set that page as
no-index
so that Google doesn't index it and also you may want to remove it from the site map. WordPress SEO from Yoast certainly allows you to do the former.