diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index b6ca7c24d3..9b7aa898e2 100644
a
|
b
|
function is_post_type_viewable( $post_type ) { |
2112 | 2112 | * For all others, the 'publicly_queryable' value will be used. |
2113 | 2113 | * |
2114 | 2114 | * @since 5.7.0 |
| 2115 | * @since 5.9.0 Added `is_post_status_viewable` hook to filter the result. |
2115 | 2116 | * |
2116 | 2117 | * @param string|stdClass $post_status Post status name or object. |
2117 | 2118 | * @return bool Whether the post status should be considered viewable. |
… |
… |
function is_post_status_viewable( $post_status ) { |
2132 | 2133 | return false; |
2133 | 2134 | } |
2134 | 2135 | |
2135 | | return $post_status->publicly_queryable || ( $post_status->_builtin && $post_status->public ); |
| 2136 | $is_viewable = $post_status->publicly_queryable || ( $post_status->_builtin && $post_status->public ); |
| 2137 | |
| 2138 | /** |
| 2139 | * Filters whether a post status is considered "viewable". |
| 2140 | * |
| 2141 | * @since 5.9.0 |
| 2142 | * |
| 2143 | * @param bool $is_viewable Whether the post status is "viewable". |
| 2144 | * @param stdClass $post_status Post status object. |
| 2145 | */ |
| 2146 | $is_viewable = apply_filters( 'is_post_status_viewable', $is_viewable, $post_status ); |
| 2147 | |
| 2148 | // Make sure the filtered value is a boolean type before returning it. |
| 2149 | if ( ! is_bool( $is_viewable ) { |
| 2150 | return false; |
| 2151 | } |
| 2152 | |
| 2153 | return $is_viewable; |
2136 | 2154 | } |
2137 | 2155 | |
2138 | 2156 | /** |