An Ultimate Guide to A Custom 404 Error Page In WordPress


It’s inevitable that you’re leaving a poor first impression on visitors when they try to access a page that doesn’t exist on you site, which, typically, shows up in the form of a “404 Not Found” error page. However, beyond that, a 404 error page also negatively affects your SEO benefits, because the search engines are finding difficult to crawl or index your website.

The 404 error page often offers little additional information but stating that a page cannot be found. In other words, it is relatively underutilized. The good news, WordPress nowadays makes it much easier for web designers and developers to create a custom 404 error page so that the visitors can get some useful information or be directed to another page where you want them to.

What Is a Custom 404 Error Page and Why You Need It?

We have introduced many potential errors that you may come across when running a WordPress site. But sometimes, you just cannot fend off all of them completely. That’s why we repeatedly advice you to regularly check and double check every link in your website.

When it specifically comes to the error 404, it is a message that the visitors receive when visiting a page or post that is not located. This is included within WordPress by default, but not with all themes. So, if you have basic coding knowledge, you can create your own theme and insert a properly designed 404 error page into it, increasing the chances of your users sticking around even though they failed to find what they are looking for.

How to Have a Custom 404 Error Page?

In fact, there are more than one ways you can take advantage of to create your basic 404 page. Here I’ll go through two widely-used solutions to actually setting up a custom 404 error page in WordPress.

S1: Setting Up a 404 Page on a Child Theme

Every theme shipped with WordPress are ensured to come with a 404.php file, some even feature their own custom 404 error template file in the name of 404.php. Every time a Page Not Found error occurs, WordPress will automatically use either the normal or the custom 404.php page.

To edit the 404 error template file of your theme so that it can properly provide your users with what you want to deliver to them, you need to open it in a text editor. Then, edit the message to communicate your ideas precisely, save the changes, and upload it to the theme directory on your WordPress dashboard.

Take Twenty Thirteen theme as an example, the simple structure of its 404.php file looks like this:

As you can see, there are tags to display the header, footer, sidebar, as well as an area for your message. The text within the h1 heading and within the page-content class needs to be revised for displaying custom information that you want your users to see.

S2: Creating a 404 Page Using a Plugin

WordPress plugins provide one of the simplest ways to have a custom 404 error page. However, finding the best 404 plugin could be a minefield if you’re a non-tech savvy in website building area. Luckily, we’ve done the toughest work for you and pick up several reliable, user-friendly options to help you create a custom 404 error page, including 404page, Custom 404 Pro, and Forth Four.

In below, we will take 404page Plugin as an example, to show you detailed process of how to create a 404 error page using a WordPress plugin.

Step 1: Decide the 404 page

Select the page that you want to be displayed as your custom 404 error page. With the Edit Page button, you can directly start editting the selected page, and with the Test 404 error button, you will open a new 404 error page with a randomly generated URL. If you find both buttons being disabled, you must have selected a different page, what you need to do is click on the Save Changes button to enable them again.

Step 2: Hide the selected page from the pages list

When you activate this option, the page you selected as a custom 404 error page will be hidden from the Pages menu and invisible to non admin users. Don’t worry, as a admin user, you can always see it.

Step 3: Send a 404 error if the page is accessed directly by its URL

To avoid that your custom 404 error page is accessed directly by its permalink, active WordPress fires a 404 error. The option is activated by default, but if you don’t want the page to be accessible you can deactivate it, though we don’t recommend you to do.

Step 4: Force 404 error after loading page

Once a 404 error page occurred on your WordPress site, the 404page Plugin loads your custom 404 error page. When the page is successfully restored, the 404 error will disappear.

Step 5: Disable URL autocorrection guessing

A URL Autocorrect Guessing feature is designed with WordPress core from the very beginning, which lets WordPress try to guess what is the redirection of a nonexistent URL. But this features is not always helpful for the reason that WordPress in nature is not a good gusser. It happens a lot that WordPress mistakenly redirect visitors to unmatched content. So, rather than suffer from the wrong automatic guessing, getting a 404 error seems better. When this option is activated, WordPress will not be able to guess and automatically redirect a nonexistent URL.

In addition to the above, you should also let 404page Plugin send an HTTP 410 error instead of HTTP 404 in case the requested object is in trash. And if your 404page Plugin fail to work properly, you can try to activate Compatibility Mode to solve incompatibility with your theme and another plugin.

What Content Should Go Into Your 404 Page?

There are many improvements you can make to your 404 error page, and here are two most recommended options.

#1. Write friendly content

Your 404 error page can deliver many helpful messages to let your visitors feel reassured that this is just a minor glitch and you’re trying the best to help them find useful information as they need. Keep shorter and sweeter content while showing the users what they are looking for:

#2. Add useful links

It is frustrating when encounter a “page not found” situation on the WordPress site. The situation could improve if the page offers some helpful links that direct you to a variety of categories or areas of information within the same WordPress site.

It is advisable that you list all similar useful links in a paragraph, helping users easily find what section they are interested in.

Wrapping Up

Honestly speaking, the 404 error page is less important than other pages on your WordPress site. It’s still worth a little more thought to enhance the user experience, anyway. To take this one step further, this can help ensure a greater stickness even when they receive nothing but an error.