Make WordPress Core

Opened 6 years ago

Last modified 23 months ago

#43347 new feature request

Introduction of 'has_single' register_post_type parameter

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


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 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 (2)

#1 @powerbuoy
4 years ago

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_single work:

Official support would be preferred obviously.

This ticket was mentioned in Slack in #core-editor by talldanwp. View the logs.

23 months ago

Note: See TracTickets for help on using tickets.