How to Create a Custom 404 Page in WordPress (and Why It Matters)

Every website eventually sends visitors to a page that doesn’t exist. A permalink changes, an old post gets deleted, or someone follows a broken link from another site. When that happens, WordPress returns a 404 error — and on most fresh installs, that means a sparse, unhelpful page that gives visitors nowhere to go.

The default behaviour is a missed opportunity. A well-built 404 page can redirect that traffic back into your site rather than losing it entirely. It takes under an hour to set up, and once it’s in place, it handles those moments quietly without any ongoing effort.

The way I approach it: treat the 404 page as part of your navigation, not as an error state. Visitors land there by accident — the job of the page is to give them a quick route back to something useful.

What a Good 404 Page Should Do

A custom 404 page doesn’t need to be elaborate. Its job is simple: acknowledge the error, explain why it might have happened, and give visitors a clear path forward. That usually means a short message, a link back to the homepage, a search bar, and links to a few key pages or categories.

What it shouldn’t do is leave visitors on a blank dead end, or redirect every 404 silently to the homepage — which confuses both visitors and search engine crawlers. A proper 404 response with useful navigation is the right approach.

How Google Treats 404 Pages

From an SEO perspective, 404 errors are normal. According to Google’s crawling documentation, 404 responses cause Google to stop processing those URLs and eventually remove them from its index — which is the correct behaviour for pages that genuinely no longer exist.

The issue isn’t the 404 itself. It’s what the visitor experiences when they hit it. A custom page recovers traffic that would otherwise be lost; the default page loses it entirely.

How to Create a Custom 404 Page in WordPress

The method depends on your theme or page builder. These are the three most common approaches.

Option 1 — Theme Builder (Recommended)

Most popular WordPress themes — including Kadence, Astra, and GeneratePress — include a dedicated template for the 404 page in their theme builder or theme customiser. This is the cleanest approach because it keeps the 404 page on-brand without any extra plugins.

  1. Open your theme settings or theme builder — the exact location varies by theme.
  2. Look for a 404 Page template option.
  3. Design the layout using your theme’s block editor or visual builder.
  4. Save and publish the template.

Option 2 — Elementor or Divi Theme Builder

If you use Elementor Pro or Divi, both include a theme builder that lets you assign a custom template to 404 errors.

In Elementor: go to Templates → Theme Builder, create a new template, and choose Error 404 from the conditions dropdown. Design the page and publish it with the condition set to display for all 404 errors.

In Divi: go to Divi → Theme Builder, add a new template, enable it for 404 Page, and build the layout in the visual editor.

Option 3 — Edit the 404.php Template File

If you’re comfortable editing theme files, you can modify the 404.php file in your theme directly. This works with any theme and gives full control over the layout. I only recommend this if you’re using a child theme — editing the parent theme file directly means your changes get overwritten on the next theme update.

Open Appearance → Theme File Editor, select your theme, and find 404.php. Add your error message, a search form using get_search_form(), and links to your main pages.

What to Include on Your 404 Page

Whether you design it visually or in code, the content should cover these elements:

  • A short, plain-language message — “Page not found” is fine. No need for humour unless it genuinely fits your brand.
  • A link back to the homepage.
  • A search bar — this is the single most useful element, as it lets visitors find what they were looking for without guessing.
  • Links to 2–3 key sections: your main blog page, a services page, or your most-visited category.

On content-heavy sites, a short list of recent or popular posts also works well. Keep the layout clean — the goal is fast navigation, not a busy page. Use your site’s normal header and footer so visitors have the full navigation menu available.

Practical Tips

If you’ve recently changed your WordPress permalink structure, some old URLs will be generating 404 errors. The 404 page handles unexpected errors, but for known broken URLs, setting up 301 redirects in WordPress is the right fix — redirects send visitors and crawlers to the correct destination automatically.

Run a broken link check after any major content reorganisation. Finding and fixing broken links in WordPress covers the tools that make this quick to do, and catching internal 404s early is much easier than tracking them down after the fact.

After setting up or updating your 404 template, test it by visiting a non-existent URL on your site. This step takes thirty seconds and confirms the page is displaying correctly and the navigation links work.

Common Mistakes

Redirecting all 404s to the homepage. This seems helpful but it isn’t. Visitors arrive on the homepage without context, don’t know why they’re there, and often leave anyway. It also sends misleading signals to search engine crawlers. A proper 404 response is the correct technical answer.

Leaving the WordPress default page in place. The default 404 on most themes gives visitors nothing to do. Replacing it is one of the first things worth doing on any new WordPress site — it’s a small task with an outsized impact on the visitor experience.

Stripping out the site header and footer. Some 404 templates remove the navigation to create a focused error page. The problem is that visitors who hit a 404 need navigation more than most — removing it makes the dead end worse, not better.

When a Redirect Is Better Than a 404

Use a custom 404 page for unexpected errors: broken external links, mistyped URLs, or pages that no longer exist with no clear replacement.

Use a 301 redirect when a page has moved permanently to a new URL and you know where it now lives. This preserves any SEO value the original URL had built up, and it sends visitors to the right place without the interruption of an error page.

In practice, both are part of the same workflow. Set up redirects for any URLs you know have changed, and use the 404 page as the fallback for everything else. The step-by-step guide to building a WordPress website covers how these pieces fit into setting up a site properly from the start.

Conclusion

A custom 404 page is a small part of a WordPress site, but it earns its place. Add a search bar, a few navigation links, and a plain error message — then move on. It’s one of those foundations that works quietly in the background, recovering visitors that would otherwise be lost.