WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#17350 closed defect (bug) (duplicate)

Empty custom post archive page produces a 404 error

Reported by: danielpataki Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Query Keywords:
Focuses: Cc:

Description

Hello everyone,

This has been an issue I think for a while, I tried searching but couldn't find a ticket. If you create a post type, and specify it should have an archive, everything works fine, however, if there are no results, the page defaults to the 404 error.

This is a problem for custom posts because if you use it to add live conferences to your site for example, you might run into situations where there are no upcoming items, or only drafts, so the default query on the page would not have an results.

I believe the solution should be to not go to the 404 page, but use the same template file, as we can use if (have_posts) to determine weather there are posts or not. Technically this isn't a page not found, it's a page without any items on it.

Change History (2)

comment:1 @markmcwilliams4 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

comment:2 @ocean904 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.