Opened 8 years ago
Last modified 4 years ago
#43347 new feature request
Introduction of 'has_single' register_post_type parameter
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Posts, Post Types | Keywords: | |
| Focuses: | template | Cc: |
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.
I know this is a two year old issue by now, but for anyone else requesting this I've written some code to make
has_singlework: https://github.com/powerbuoy/sleek-post-types/blob/master/has-single.phpOfficial support would be preferred obviously.