# WordPress 404 page

> Where WordPress gets its 404 page in classic and block themes, how to edit it, and how to confirm it returns a real 404 status instead of a soft 404.

Canonical: https://scaplet.com/seo/wordpress/404

Guide WordPress WordPress · 404 errors

Where WordPress gets its 404 page in classic and block themes, how to edit it, and how to confirm it returns a real 404 status instead of a soft 404.

4 min

read

5

sources

Oct 28, 2026

updated

Scaplet Editorial Team

author

In one line

WordPress looks for `404.php` in a classic theme, then falls back to `index.php`. Block themes use an HTML template with the same hierarchy, which you can edit in the Site Editor. Whatever the page says, the HTTP status must be 404. Google treats a 2xx page that shows an error as a soft 404.

30-second check

## Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?

Summarize this page with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fseo%2Fwordpress%2F404%20(%22WordPress%20404%20page%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fseo%2Fwordpress%2F404%20(%22WordPress%20404%20page%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fseo%2Fwordpress%2F404%20(%22WordPress%20404%20page%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fseo%2Fwordpress%2F404%20(%22WordPress%20404%20page%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

On this page

## 4 parts, 4 minutes.

1. [Where WordPress finds the 404 template 01](#where-wordpress-finds-the-404-template)
2. [When WordPress sends a 404 02](#when-wordpress-sends-a-404)
3. [Edit the page 03](#edit-the-page)
4. [Check it returns a real 404 04](#check-it-returns-a-real-404)

_01_The 404 path in the template hierarchy

## Where WordPress finds the 404 template

Theme type

### Classic theme

File WordPress looks for first

`404.php`

Fallback

`index.php`

Where you edit it

The theme's files, ideally in a child theme

Theme type

### Block theme

File WordPress looks for first

The 404 template, an HTML file instead of PHP

Fallback

The theme's index template

Where you edit it

Appearance > Editor, then Templates

WordPress's Theme Handbook says that for 404s, template files are called in the order `404.php`, then `index.php`, and that block themes use HTML files while the hierarchy stays the same. It also says that if WordPress cannot find any matching template, the theme's `index.php` is used. A child theme file overrides the same file in the parent theme.

The Site Editor documentation describes the Templates section as where you review layouts for sections of your site, including [search results](/glossary/serp) and 404.

_02_Checklist

## When WordPress sends a 404

WordPress decides the status after it queries posts. The developer reference for `WP::handle_404()` says WordPress issues a 404 if a request doesn't match any posts and doesn't match any object (for example a category, tag or author), if a 404 was not already issued, and if the request was not a search or the homepage. Otherwise it issues a 200.

First_1_
An existing category, tag or custom taxonomy term with no posts does not get a 404, because the source skips the 404 when the query matched a term object. A term or author that does not exist, or a paged URL past the last page, does.

Next_1_
A search with no results is not a 404, so a no-results search page keeps a 200.

Then_1_
`is_404()` is the conditional tag, and it returns true when the query returned no results. It does not work before the query runs. Hook it on `wp`, as a note on its reference page suggests, if you want to add something only to 404s.

_03_How it works

## Edit the page

1. 1

### Classic theme

Create or edit `404.php` in a child theme. If the file is missing, WordPress falls back to `index.php`, so a new `404.php` is what gives you a dedicated page.
2. 2

### Block theme

Open Appearance > Editor, choose Templates, and open the 404 template. Save changes when you finish. WordPress's Site Editor page says the Save button lists the synced patterns, navigation menus, templates and template parts you changed, and you can save all or just some of them.
3. 3

### Give people a way out

Add a link to the home page, a search form, and a few useful pages. Keep the page's own status at 404, whatever the content.

**A pretty page with a 200 is a soft 404**Google's [status code](/glossary/http-status-codes) documentation says that if a 2xx response suggests an error to Search, such as an empty page or an error message, [Search Console](/glossary/google-search-console) will show a [soft 404 error](/glossary/soft-404). A plugin or custom redirect that serves your 404 design with a 200 causes this.

_04_How it works

## Check it returns a real 404

Replace `example.com` with your domain. The first line of the response should show 404, for example `HTTP/2 404`. A 200 or a redirect means something is rewriting the response.

Request a URL that cannot exist

```
curl -I https://example.com/this-page-should-not-exist-12345
```

Google also says newly encountered 404 pages aren't processed and that crawling frequency gradually decreases. A 404 is the normal answer for a URL that should not exist. See the [soft 404 entry](/glossary/soft-404) for the distinction.

1. 01

### In the browser

Open the same URL with Developer Tools on the Network tab. The status column for the document request should read 404.
2. 02

### In Search Console

Google says it doesn't index URLs that return a 4xx status code and removes already indexed ones. Look for [soft 404 errors](/seo-issues/soft-404-errors), which Google says Search Console shows, and see [WordPress Search Console](/seo/wordpress/search-console) for access.
3. 03

### Chase the broken inbound links

If a deleted page had traffic or links, a [WordPress redirect](/seo/wordpress/redirects) to the closest replacement beats a 404. Use a 404 where nothing replaces it.

Sources · 5

## Every fact, linked and dated.

Official docs first. The date is when we last opened each page.

- wordpress.org
- google.com

1. 01 [Template Hierarchy | Theme Handbook | WordPress Developer Resources](https://developer.wordpress.org/themes/basics/template-hierarchy/) developer.wordpress.org · checked 2026-11-01
2. 02 [WP::handle_404() | WordPress Developer Resources](https://developer.wordpress.org/reference/classes/wp/handle_404/) developer.wordpress.org · checked 2026-11-01
3. 03 [is_404() | WordPress Developer Resources](https://developer.wordpress.org/reference/functions/is_404/) developer.wordpress.org · checked 2026-11-01
4. 04 [Site Editor | WordPress.org Documentation](https://wordpress.org/documentation/article/site-editor/) wordpress.org · checked 2026-11-01
5. 05 [How HTTP status codes affect Google's crawlers | Google for Developers](https://developers.google.com/search/docs/crawling-indexing/http-network-errors) developers.google.com · checked 2026-11-01

Questions

## Asked a lot.

3 questions people ask next, answered from the sources on this page.

_01_ How do I create a custom 404 page in WordPress?

In a classic theme, add `404.php`. In a block theme, edit the 404 template at Appearance > Editor > Templates. WordPress falls back to `index.php` if there is no 404 template.

_02_ Should a WordPress 404 page redirect to the home page?

Not as the default. Google says an error-looking page with a 2xx status shows up as a soft 404 in Search Console. Redirect only when a close replacement exists, and keep the real 404 for URLs with none.

_03_ How do I check my 404 page returns status 404?

Run `curl -I` against a URL that does not exist, or open it in the browser's Network tab, and confirm the status is 404.

## Keep learning

[All platform guides](/seo)

[Learn WordPress redirects CMS](/seo/wordpress/redirects) [Related Soft 404 Crawling](/glossary/soft-404) [Read next WordPress SEO CMS](/seo/wordpress) [Do Run a free site audit Free, about two minutes](/site-audit)

Nearby in platform guides
[WooCommerce speed optimization](/seo/woocommerce/page-speed) [WordPress SEO](/seo/wordpress)

More in WordPress SEO
[AMP on WordPress](/seo/wordpress/amp) [Google Analytics on WordPress](/seo/wordpress/google-analytics) [How to put WordPress in maintenance mode](/seo/wordpress/maintenance-mode) [WordPress 404 page](/seo/wordpress/404) [WordPress AI crawlers](/seo/wordpress/ai-crawlers) [WordPress breadcrumbs](/seo/wordpress/breadcrumbs) [WordPress canonical tags](/seo/wordpress/canonical-tags) [WordPress Core Web Vitals](/seo/wordpress/core-web-vitals) [WordPress favicon](/seo/wordpress/favicon) [WordPress Google Search Console setup](/seo/wordpress/search-console) [WordPress hreflang and multilingual SEO](/seo/wordpress/hreflang) [WordPress HTTPS](/seo/wordpress/ssl) [WordPress image SEO](/seo/wordpress/image-seo) [WordPress internal links](/seo/wordpress/internal-links) [WordPress lazy loading](/seo/wordpress/lazy-loading) [WordPress noindex](/seo/wordpress/noindex) [WordPress redirects](/seo/wordpress/redirects) [WordPress robots.txt](/seo/wordpress/robots-txt) [WordPress SEO plugins](/seo/wordpress/seo-plugin) [WordPress SEO titles and meta descriptions](/seo/wordpress/title-and-meta) [WordPress speed optimization](/seo/wordpress/page-speed) [WordPress structured data](/seo/wordpress/structured-data) [WordPress www redirect](/seo/wordpress/www-redirect) [WordPress XML sitemap](/seo/wordpress/xml-sitemap)

Terms on this page
[SERP](/glossary/serp) [HTTP status codes](/glossary/http-status-codes) [Google Search Console](/glossary/google-search-console) [Soft 404](/glossary/soft-404)

Free · 2 minutes

## Tools point. Agencies advise. _This one ships._

Run the free audit, then approve the fixes. Every change can be undone.

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **0→7** ChatGPT citations in six weeks Paylane
