[wp-trac] [WordPress Trac] #49628: Add is_post_type_viewable filter
WordPress Trac
noreply at wordpress.org
Thu Mar 12 11:43:12 UTC 2020
#49628: Add is_post_type_viewable filter
-------------------------------+-----------------------------
Reporter: powerbuoy | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 5.3.2
Severity: normal | Keywords:
Focuses: administration |
-------------------------------+-----------------------------
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()`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49628>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list