• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
wpdesigner-logo

WPDesigner

WordPress Themes, Blog Design, and Web Development

  • News
  • Tutorials
    • Theme Development
    • WordPress Tips
  • Resources
  • Reviews
    • Hosting Reviews
  • Collections
    • Plugin Collections
    • Theme Collections
  • Contests
  • WWMD
  • Our Themes
  • Login
WPDesigner » Tutorials

How to Customize 404 Error Page

Last Updated on May 8, 2018 by Jazib Zaman

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.

About Jazib Zaman

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

  • LinkedIn
  • Pinterest
  • RSS
  • Twitter

Recent Posts

  • Secure Your WordPress Admin Area with Some Reliable Tools
  • What is SEO and How Does it Work?
  • 40+ Solutions to Supercharge Your WordPress Website
  • Create Your Own Website or Outsource to a Web Studio?
  • 4 Things You Will Need for a Successful Career in the Tech Industry

Copyright © 2023 · All Rights Reserved · A Project of TechAbout LLC.
All of our themes are 100% GPL compatible.

  • About
  • Write for us
  • Archives
  • Contributions
  • Privacy Policy
  • Feedback
  • Terms & Conditions