diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index 2487e5b4c2..1790580c18 100644
a
|
b
|
function set_post_type( $post_id = 0, $post_type = 'post' ) { |
2084 | 2084 | * @since 4.4.0 |
2085 | 2085 | * @since 4.5.0 Added the ability to pass a post type name in addition to object. |
2086 | 2086 | * @since 4.6.0 Converted the `$post_type` parameter to accept a `WP_Post_Type` object. |
| 2087 | * @since 5.9.0 Added `post_type_viewable` hook to filter the result. |
2087 | 2088 | * |
2088 | 2089 | * @param string|WP_Post_Type $post_type Post type name or object. |
2089 | 2090 | * @return bool Whether the post type should be considered viewable. |
… |
… |
function is_post_type_viewable( $post_type ) { |
2100 | 2101 | return false; |
2101 | 2102 | } |
2102 | 2103 | |
2103 | | return $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public ); |
| 2104 | $is_viewable = $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public ); |
| 2105 | |
| 2106 | /** |
| 2107 | * Filters whether a post type is considered "viewable". |
| 2108 | * |
| 2109 | * @since 5.9.0 |
| 2110 | * |
| 2111 | * @param bool $is_viewable Whether the post type is "viewable". |
| 2112 | * @param WP_Post_Type $post_type Post type object. |
| 2113 | */ |
| 2114 | return apply_filters( 'post_type_viewable', $is_viewable, $post_type ); |
2104 | 2115 | } |
2105 | 2116 | |
2106 | 2117 | /** |