This is a super simple and quick guide to help you create a WordPress custom 404 page without using a plugin. No plugin required at all!
SEO-Optimised Custom 404 Page for WordPress
This is my own SEO-optimised custom 404 page for WordPress, it doesn’t just give you a custom 404 page but also adds in a full sitemap for your website. So if any pages are missing both human users and bots can find the missing links or alternative links to discover. Good for the user and good for SEO.
Create a WordPress custom 404 page without a plugin
Before you start – You need to have administrative access to your WordPress site and SFTP access. You should also always take a full database and theme file backup before making any changes.
1. Go to your theme folder
2. Create and name a file 404.php
3. Paste the code below into the 404.php file
4. Now tweak to fit your site
5. View on your site by going to “yourdomain.com/error”
WordPress Sitemap Page Code
Below is the WordPress custom 404 page file. This supports Posts, Pages, Custom Post Types and WooCommerce Products. If you don’t want or need Custom Post Types or WooCommerce products support then just delete those loop at the bottom (I’ve annotated each section so should be easy to find).