Skip to content
WordPress Guide

How to Make a Custom 404 Page in WordPress

A plain 'nothing found' message is a dead end for visitors. Here is how to turn your 404 page into a useful signpost without confusing search engines.

A desk with website wireframes, a phone and coloured pens
8 sections · 7 min read
In this article · 8 sections

Type a made-up address after your domain, something like /this-page-does-not-exist/, and look at what appears. On many business sites it is a bare “Nothing found” message in the theme’s default style, sometimes with a search box, sometimes with nothing at all. A visitor who followed an old link from a directory or an email lands there, sees no way forward, and closes the tab.

A custom 404 page in WordPress turns that dead end into a signpost. In most themes it does not need a developer, and once it is done it rarely needs touching again. Where the page lives depends on your theme or builder, and what goes on it matters less than one technical detail that must not change: the page has to keep telling search engines that the address does not exist.

What a 404 page is, and what it is not

When someone asks for an address on your site that has no page, WordPress sends back a “404 Not Found” status and shows a page made from your theme’s 404 template. Visitors only see the page. Browsers and search engines also see the status code, which tells them the address is empty.

Designing the page is about helping people who arrive there. It does not fix the missing addresses themselves. If a page used to exist and moved, the right answer is a redirect from the old address; if dozens of addresses broke after a rebuild, our guide to fixing 404 errors after a redesign covers finding and mapping them. And if every page except the home page shows a 404, the cause is almost always permalinks, explained in our post on pages that 404 while the home page works.

What to put on a custom 404 page in WordPress

Keep it short. The visitor wanted something else, and your job is to get them there quickly.

  • A plain heading that says the page was not found. “We can’t find that page” works better than a joke, especially for a business.
  • One or two lines suggesting what may have happened: the page moved, or the address was mistyped. Do not blame the visitor.
  • A search box, so people can look for what they wanted.
  • Links to your main pages: services, prices if you publish them, contact, and perhaps your most visited blog posts.
  • A way to reach you: your phone number as a tap-to-call link, or a button to the contact page.
  • Your normal header and footer, so the visitor knows they are still on your site and the menu still works.

What to leave out: large images, animations, popups, and anything that makes the page heavy. Some 404 visits come from bots trying random addresses, and there is no reason to send them a large page.

How to edit the 404 page in a block theme

Block themes, such as recent default WordPress themes, include a 404 template you can edit visually.

  1. Go to Appearance → Editor and choose Templates.
  2. Find the 404 template. Its label varies between WordPress versions and themes, but it includes “404”.
  3. Open it. You will see the header and footer template parts with the theme’s default message in between.
  4. Edit the heading and text. Add a Search block if the theme did not include one, a List block or Buttons block with links to your main pages, and a short contact line.
  5. Save. WordPress stores your version of the template and uses it from now on, even after theme updates.

If you want to undo your changes later, the Site Editor can reset a template to the theme’s original. Resetting is covered, along with what it throws away, in our walkthrough of the Site Editor’s templates. For the search box itself, our post on adding a search bar in WordPress covers the Search block’s settings.

How to edit the 404 page in a classic theme

Classic themes vary more, so check these in order:

  1. Theme options. Some classic themes have a 404 section in the Customizer or their own options panel, letting you change the message or choose a layout. Look under Appearance → Customize first.
  2. Widgets. A few themes show a widget area on the 404 page. If yours does, you can add links and a search box under Appearance → Widgets.
  3. The 404 template file. Most classic themes have a file called 404.php that builds the page. To change it properly, copy it into a child theme and edit the copy there, so a theme update does not overwrite your work. This needs basic PHP and HTML knowledge, so it is a job to hand over if you have never edited a theme file.

If the theme has no 404.php at all, WordPress falls back to the theme’s general template, which is why some sites show an odd, empty blog layout for missing pages.

Using a page builder or plugin

If your site is built with a page builder, its theme-building feature may handle the 404 page. Elementor Pro, for example, includes a 404 template type in its theme builder, so you can design the page with the same tools as the rest of the site.

There are also plugins that let you design a normal WordPress page and use it as the 404 page. If you go this way, choose one that keeps sending the 404 status, and check it with the test below. The page you design should also be hidden from your menus and set to noindex in your SEO plugin, so the page itself does not turn up in search results.

Keep it a real 404

This is where well-meant changes go wrong. Two common shortcuts make things worse:

  • Redirecting every missing address to the home page. Some plugins offer this as a feature. Visitors land on a page that has nothing to do with the link they clicked, and Google tends to treat these redirects as “soft 404s”, meaning pages that say they exist but are really empty.
  • Making the custom page return a normal “200 OK” status. This can happen with some plugin or builder setups. Search engines then think every random address on your site is a real page.

Redirect a missing address only when there is a genuinely matching page to send it to, one by one. Our guide to setting up a 301 redirect explains how. For everything else, let the custom 404 page do its job.

How to test it

  1. Open a made-up address on your site in a private browser window, so you see what a logged-out visitor sees.
  2. Check the page looks right on a phone and every link on it works.
  3. Check the status: in your browser’s developer tools, open the Network tab, reload the page, and look at the first entry. Its status should be 404.
  4. Later, look at the page indexing report in Google Search Console. If “Soft 404” appears there for many addresses, something is redirecting or returning the wrong status.

Keeping an eye on what people were looking for

Once the page is in place, the 404 page can teach you something. If your analytics tool records page titles, filter for your 404 page’s title to see which missing addresses people actually visit. A missing address that gets regular visitors is worth a redirect to the right page. One that only bots hit can be ignored.

A custom 404 page is a small, finished job, the kind our WordPress owner’s guide is full of. Your theme decides most of how it looks, and our overview of how WordPress themes work explains where its templates come from.

Frequently asked questions

Does a custom 404 page help SEO?

Not directly. Search engines do not reward a nicely designed 404 page. What matters to them is that missing addresses return a real 404 status and that moved pages are redirected properly. The benefit is for visitors, who are more likely to stay and find the right page instead of leaving your site.

Should I add my contact form to the 404 page?

A link or button to your contact page is usually better than a full form. A form on the 404 page attracts more spam, because bots that hit random addresses see it too. A short line with your phone number and a contact button gives real visitors a quick way to reach you.

Why does my 404 page look different from the rest of my site?

Your theme builds the 404 page from its own template, which may have been designed with less care than the main pages or use a different layout. A page builder header may also be missing if its display rules exclude 404 pages. Check the template in the Site Editor, theme options or builder and match it to your other pages.

Is it bad for my site to have some 404 errors?

No. Every site has some, because people mistype addresses and bots try random ones. Google has said that 404s for addresses that never existed do not count against a site. The ones worth fixing are old addresses that used to be real pages and still get visitors or links, because those deserve a redirect.

Real pages landing on the 404 page is a different problem from how it looks: something is breaking addresses. Tracing that back is the kind of job our WordPress bug fixing service takes on.

Is Your Website Working Properly?

Get a free website health check from WebMaintor. We'll review your website's speed, security, forms, and technical health — and tell you exactly what needs attention.

No obligation. No automated reports. A real review by our team.