Skip to main content

WordPress: Creating an Error 404 Page

Popularity Report

Total Popularity Score: 0

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Rank

URL Tag Cloud

Bookmark History

Saved by 2 people (0 private), first by anonymouse user on 2006-08-10


Public Sticky notes

To edit your Theme's 404 error template file:

  1. Open your WordPress admin panel:
  2. Choose Presentation menu.
  3. Choose the Theme Editor page.
  4. Check to see if your theme includes a '404 Template' in the list of files.
  5. Click the link for '404 template' along the right side of the page.
  6. Edit the message text to say what you want it to say.
  7. Save your changes. (If the template file is not writable, see Changing File Permissions.)

While you are examining and editing your 404 template file, take a look at the simple structure of the default 404.php file. It basically features tags that display the header, sidebar, and footer, and also an area for your message:

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

So, to change the error message your visitor sees, revise the text within the h2 heading and if necessary, add more paragraphs below that

Highlighted by marketto

Creating an Error 404 Page

Highlighted by marketto

To use the 404.php template file from the WordPress Default Theme:

  1. Copy the file /wp-content/themes/default/404.php into the directory of your current theme.
  2. Then, as described in the previous section, edit the error message to present your desired error message.

If copying the default 404.php into your theme directory does not work well with your theme, you have some other choices:

  • Change the Default Theme's 404.php template file's header, sidebar, footer, and other codes to match the rest of the Theme's layout.

Or

  • Copy the index.php file of your current theme to a file called 404.php.
  • Open that file and delete all sections dealing with posts or comments, see The Loop.
  • Then, edit your 404 error message.

Highlighted by marketto