[wp-trac] [WordPress Trac] #17350: Empty custom post archive page produces a 404 error

WordPress Trac wp-trac at lists.automattic.com
Sat May 7 14:36:26 UTC 2011


#17350: Empty custom post archive page produces a 404 error
--------------------------+-----------------------------
 Reporter:  danielpataki  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17350>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list