WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#41626 closed enhancement (duplicate)

Template Hierarchy: Custom 404 pages for CPTs

Reported by: ramiy Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: template Cc:

Description

Currently theme developers can customize only one error page they can design - using the 404.php file. We can't create custom 404 pages based on CPT's. Let's change that!

WordPress template hierarchy supports CPT's with single CPT pages single-{post-type}.php, archive CPT pages archive-{post-type}.php and embed pages embed-{post-type}.php. It's missing the option to create custom 404 pages for CPTs in a form of 404-{post-type}.php.

Let's extend the 404 pages with a new template file path:

  • 404-{post-type}.php
  • 404.php
  • index.php

Change History (1)

#1 @johnbillion
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Thanks for the suggestion. This is already being worked on in #23049.

Note: See TracTickets for help on using tickets.