[wp-trac] [WordPress Trac] #37376: Make it possible for custom post type to have an archive but no single
WordPress Trac
noreply at wordpress.org
Fri Jul 15 17:55:35 UTC 2016
#37376: Make it possible for custom post type to have an archive but no single
-----------------------------+-----------------------------
Reporter: jason_the_adams | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: |
-----------------------------+-----------------------------
Very commonly we'll have testimonials, faqs, and such custom post types,
which warrant an archive, but don't make sense to have a single. It's
possible to have a post type with no archive and a single, but not the
other way around. Funnily enough, I find that we far more often could use
what isn't available versus what is.
There are workarounds. One option is to make it a non-publicly-queryable
post type and use a page template or something to display the results.
Another option I've seen around is to hook into template_redirect on the
single and redirect the user. Chances are there's no links on the front-
end, so this really only occurs when users click on the link from edit-
post admin-side.
Another thing to consider here is SEO plugins and the like which look to
the definition of the CPT to build the sitemap. The redirect method ends
up putting useless links in the sitemap. The page template method works
fine, but obviously means the CPT has to be queried separately.
Would there be a downside to adding a sibling `has_single` option? If it's
true by default then it's backwards compatible, and the single rewrites
simply reflect the option.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37376>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list