WordPress.org

Make WordPress Core

Opened 20 months ago

#43347 new feature request

Introduction of 'has_single' register_post_type parameter

Reported by: stevepuddick Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords:
Focuses: template Cc:
PR Number:

Description

I have done some research but have not been able to find anything exactly on this issue.

I frequently encounter use cases where I need to create a CPT with the following characteristics:

1) disable the slug display/editor from the admin post edit page (this is for usability. It is not used and having it available/displayed can confuse website editors)
2) maintain the archive page is viewable on the front end
3) disable the single page for the CPT on the front end

I have found some partial solutions like this https://wordpress.stackexchange.com/questions/128636/how-to-disable-the-single-view-for-a-custom-post-type but setting 'publicly_queryable' => false would disable the archive view.

The register_post_type function includes the has_archive parameter. Is it possible to introduce a has_single parameter which will achieve the desired functionality stated above?

I feel this can be beneficial in many cases, to the extent it is worthwhile introducing as a core feature.

Change History (0)

Note: See TracTickets for help on using tickets.