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
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.
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.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
404.phpindex.phpWordPress'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 and 404.
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.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.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.
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.
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.
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.curl -I https://example.com/this-page-should-not-exist-12345Google 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.
Open the same URL with Developer Tools on the Network tab. The status column for the document request should read 404.
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.
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.
3 questions people ask next, answered from the sources on this page.
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.
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.
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.
Run the free audit, then approve the fixes. Every change can be undone.