How to Create a 404 Page

in WordPress Tutorials

A 404 page is an important template in any theme as it lets visitors know when they have stumbled across a page which is no longer there (or never was). Most free and premium themes usually have a 404 page already though occasionally the developer has forgot to add the 404 template. Therefore, you may have to create the page yourself.

You’ll be happy to know that creating a 404 error page will not take you more than a few minutes.

Creating the 404 Error Page

WordPress automatically searches for a 404.php template file within your current themes directory if it encounters a 404 error. Therefore to create a 404 error page you simply need to create a template called 404.php and enter your error message onto it.

First thing you need to do is open up your text editor and copy the code from your page shell into it (Remember, this is the code from your page template with the WordPress Loop stripped away). Then all you need to do is enter an error message within the content area.

It should now look something like this:

get_header(); ?>
	<div id="content" class="narrowcolumn">
		<h2 class="center">Error 404 - Page Not Found</h2>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

Obviously, you should make your 404 error message a little more personal than simply stating ‘Page Not Found’. For example, you could write something like:

It seems you have stumbled across a page which is no longer there. Why not search our archives or use our search box at the top of our sidebar to find what you are looking for.

If you would like to learn more about developing your 404 error page, I recommend reading the ‘Creating an Error 404 Page‘ over at the WordPress Codex.

Good luck,

Comments (1)

  • Comment by 500 Creative 404 Error Pages
    500 Creative 404 Error Pages

    […] few months ago I wrote a short article showing how you can create a 404 error page in […]