Opened 10 months ago
Last modified 6 months ago
#49628 reviewing feature request
Add is_post_type_viewable filter
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 5.3.2 |
Component: | Posts, Post Types | Keywords: | has-patch |
Focuses: | administration | Cc: |
Description
It would be great if we could hook into is_post_type_viewable() and override the check.
We've created a new config for post types; has_single
, which works very much like has_archive
only it disables single pages for a post-type (useful for post-types such as office
or employee
which usually in our cases only have archive pages).
However, even though the post-type shows a 404 on single (using template_redirect
), inside the admin the "View"-links and "Permalink" settings still show up. It seems the easiest way to hide everything related to single pages is to simply return false
from is_post_type_viewable()
.
Attachments (2)
Change History (9)
#2
@
10 months ago
Found a duplicate of that: #43347 but seems abandoned. Perhaps adding an is_post_type_viewable filter will be easier?
#3
@
10 months ago
- Keywords has-patch added
Hi @powerbuoy,
Thank you for the ticket. 49628.diff introduces a new filter post_type_viewable
which exposes $post_type
to allow users to return either true
or false
depending on their needs.
#4
@
10 months ago
- Milestone changed from Awaiting Review to 5.5
- Owner set to SergeyBiryukov
- Status changed from new to reviewing
Thinking about it, an even better solution would probably be to add official support for
has_single
:)