Home Tutorials How to Customize 404 Error Page

How to Customize 404 Error Page

Author

Date

Updated on

Category

Your WordPress blog sends readers to a 404 Error page when they request for pages that don’t exist or have been moved. 404 means not found.

If your WordPress theme doesn’t have a 404.php template file, your blog redirects your readers to the front page in case of 404 errors. That might cause confusion because some readers will not know why they were sent back to the front page.

If your theme does have a 404.php template file, you can customize the error message and offer your readers some options on how to find the information they’re looking for or simply say, for example:

Not Found – This page doesn’t exist.

So what should you put in the 404.php file?

Simple, copy everything in the index.php file, paste it in the 404.php file, and then remove everything of The Loop, except for the Not Found area (after Else of The Loop).

An example of a customized 404:

<div class=”post”>
<h2>Not Found</h2>
</div>

Don’t copy and paste my codes. Type them out. Above the <div class=”post”> would be your headers and main column container or whatever you have that comes before the content. After the </div> would be your Sidebar and Footer or whatever you have that comes after the content.

You can take it a step further and give the reader a search form, right under the Not Found message:

<div class=”post”>
<h2>Not found</h2>

<div class=”entry”>
<?php include(TEMPLATEPATH . ‘/searchform.php’); ?>
</div>

</div>

I wrote a lesson on how to include the search form in the sidebar, but you can also include the search form in other places.So now, Not Found is the title and the search form is the main content.

Previous articleCongratulations!
Next articleWPThemes Plugin Interview

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Recent posts

10 Ways To Speed Up Post-Building Process With WordPress Gutenberg Themes

There’s no need to explain why I decided to start with Gutenberg-supporting products. All in all, Gutenberg is a well-known and long-awaited product. It is more...

HostPapa Linux Hosting: Reliable, robust and fast

As a small business owner, it can be challenging to find the right hosting provider for your website. HostPapa distinguishes itself from other web...

Are You Making These Costly Mistakes When Outsourcing?

In today’s world, it is almost impossible to find a small business where everything about the business process is done in-house. For most small...

Flat Design for Your WordPress Site: What Is It + 4 WordPress Flat Design Themes

Web designers in the past mostly used 3D styles for buttons that made the button seem more realistic. That all changed when flat design...

LawBlog WP Theme Review

Regardless of which area of law you practice, it’s imperative that you have proper online representation. You need to give your customers a feeling...

Recent comments