Custom Post Types:
- Introduce
is_post_type_viewable( $post_type_object )
- Separate the HTML bits from the translatable bits in the
post messages array in edit-form-advanced.php
- Don't show certain UI pieces when a post is not viewable on the front end
When a custom post type item is not viewable on the front end, we don't want to show links to View it (on the front end) all over the admin. We also want to hide the Preview link, et al. We also want our admin messages to not contain said links.
Custom post types with public_queryable set to false are not viewable on the front end.
'page' is viewable on the front end, but 'page' is a _builtin type, and public_queryable is set to false when it is registered - see WP::parse_request() for when public_queryable gets used.
This is confusing, but also somewhat straightforward: to determine if a post type is viewable on the front end, we can check one way for _builtin => true and another way for _builtin => false:
$post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public )
If a post type is publicly_queryable, it's viewable. If that value is false, it is viewable if it's a _builtin type that is also public.
I am in search of edge cases, so this shall land.
Props wonderboymusic, DrewAPicture.
See #17609.