Enjoy upto
80% OFF

404 error not found for WordPress

404 error not found for WordPress

While you work hard to ensure that every link on your site leads to a specific web page, there is always the possibility that a link will slam dunk and become a renowned 404 ERROR PAGE NOT FOUND.

There is hope. If a visitor encounters an error, why not be a helpful WordPress site administrator and display a message that is more informative than “NOT FOUND”?

This tutorial will show you how to make your “error” and “page not found” notifications more useful to your visitors by editing them. We’ll also teach you how to make sure your custom messages are shown on your web server. Finally, we’ll go over how to make a custom error page that matches the aesthetic of your theme.

An ounce of prevention

Some problems can be avoided by checking and double-checking all of your links on a regular basis. Also, if you’re going to remove a popular but out-of-date post, consider removing the body of the post and replacing it with a link to the new page.

Understanding web error handling

Even the most well-designed websites include flaws. You can delete out-of-date posts as a site administrator, but another website may contain a link to your post’s interior page.

When a user clicks on a link to a page that no longer exists, the web server returns an error message such as 404 Not Found. Unless your webmaster has developed special error messages, the normal message will appear in plain text, which may leave users perplexed.

Most users can hit the back key, but you’ve already lost a visitor who doesn’t want to waste their time looking for the information. At the very least, you’ll want your personalized message to include a link to your home page so that you don’t lose that visitor.

Recognizing the error and assisting them in finding their way is a nice method to manage errors. This entails either building a new Error Page or changing the one included with your WordPress theme.

Editing an error 404 page

Not all Themes have their own custom 404 error template file, but every theme shipped with WordPress includes a 404.php file. If they do, it will be named 404.php. WordPress will automatically use that page if a Page Not Found error occurs.

Every WordPress theme includes a 404.php file, although not all have their own custom 404 error template file. If they do, the file’s name will be 404.php. If a Page Not Found issue occurs, WordPress will automatically redirect to that page.

To change the message text in your Theme’s 404 error template file, open it in your favorite text editor and make the changes you wish. Then save your changes and upload it to your WordPress installation’s theme directory.

Take a look at the straightforward structure of the 404.php file that comes with Twenty Thirteen while you’re studying and editing your 404 template file. It consists of tags that display the header, sidebar, and footer, as well as a message area:

 * The template for displaying 404 pages (Not Found)
 * @package WordPress
 * @subpackage Twenty_Thirteen
 * @since Twenty Thirteen 1.0

get_header(); ?>

	<div id="primary" class="content-area">
		<div id="content" class="site-content" role="main">

			<header class="page-header">
				<h1 class="page-title"><?php _e( 'Not Found', 'twentythirteen' ); ?></h1>

			<div class="page-wrapper">
				<div class="page-content">
					<h2><?php _e( 'This is somewhat embarrassing, isn’t it?', 'twentythirteen' ); ?></h2>
					<p><?php _e( 'It looks like nothing was found at this location. Maybe try a search?', 'twentythirteen' ); ?></p>

					<?php get_search_form(); ?>
				</div><!-- .page-content -->
			</div><!-- .page-wrapper -->

		</div><!-- #content -->
	</div><!-- #primary -->

<?php get_footer(); ?>

So, to change the error message your visitor sees, revise the text within the h1 heading and within the page-content class; if necessary, add more paragraphs below that.

Creating an error 404 page

If your WordPress Theme does not include a template file named 404.php, you can create your own.

Starting with the 404.php template from Twenty Thirteen is a good beginning, though success isn’t guaranteed.

The copied error page from Twenty Thirteen adopts the current theme’s layout by calling its header and footer. The copied error page adapts to current theme, requiring minimal adjustments for customization.

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

  1. Copy the file /wp-content/themes/twentythirteen/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 can also:

  • 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.


  • 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.
  • Then, edit your 404 error message.

You may connect with us on Facebook and X. Also, check out our YouTube channel to view videos.

Golam Mostafa
Written by

Golam Mostafa

I'm a senior plugin developer for WordPress. I have four years of experience working as a software engineer for ADB Bank, and in 2018, I started developing plugins and founded ThemeDev.

Table of Content

Table of Contents

LTD Deals: 10+ Pro Plugins

Limited Time Offer
LTD Deals: 10+ Pro Plugins

Offer ends soon! Don't let it get away this time!


Trusted by 25,099+ Customers

30 days Money Back Guarantee