Free auditStart free
GuideWordPress · 404 errors

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.

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 withChatGPTClaudePerplexityGoogleAI Mode
02Checklist

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.
First1
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.
Next1
A search with no results is not a 404, so a no-results search page keeps a 200.
Then1
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.
03How 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.

04How 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 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, which Google says Search Console shows, and see WordPress Search Console for access.

  3. 03

    Chase the broken inbound links

    If a deleted page had traffic or links, a WordPress redirect 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. 01Template Hierarchy | Theme Handbook | WordPress Developer Resourcesdeveloper.wordpress.org · checked 2026-11-01
  2. 02WP::handle_404() | WordPress Developer Resourcesdeveloper.wordpress.org · checked 2026-11-01
  3. 03is_404() | WordPress Developer Resourcesdeveloper.wordpress.org · checked 2026-11-01
  4. 04Site Editor | WordPress.org Documentationwordpress.org · checked 2026-11-01
  5. 05How HTTP status codes affect Google's crawlers | Google for Developersdevelopers.google.com · checked 2026-11-01
Questions

Asked a lot.

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

01How 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.

02Should 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.

03How 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.

Free · 2 minutes

Tools point. Agencies advise. This one ships.

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

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • 0→7 ChatGPT citations in six weeks Paylane