diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index 41c0c4664c..f578e4ce35 100644
|
a
|
b
|
function is_post_type_viewable( $post_type ) { |
| 2135 | 2135 | /** |
| 2136 | 2136 | * Filters whether a post type is considered "viewable". |
| 2137 | 2137 | * |
| | 2138 | * The returned filtered value must be a boolean type to ensure |
| | 2139 | * `is_post_type_viewable()` only returns a boolean. This strictness |
| | 2140 | * is by design to maintain backwards-compatibility and guard against |
| | 2141 | * potential type errors in PHP 8.1+. Non-boolean values (even falsey |
| | 2142 | * and truthy values) will result in the function returning false. |
| | 2143 | * |
| 2138 | 2144 | * @since 5.9.0 |
| 2139 | 2145 | * |
| 2140 | | * @param bool $is_viewable Whether the post type is "viewable". |
| | 2146 | * @param bool $is_viewable Whether the post type is "viewable" (strict type). |
| 2141 | 2147 | * @param WP_Post_Type $post_type Post type object. |
| 2142 | 2148 | */ |
| 2143 | | $is_viewable = apply_filters( 'is_post_type_viewable', $is_viewable, $post_type ); |
| 2144 | | |
| 2145 | | // Make sure the filtered value is a boolean type before returning it. |
| 2146 | | if ( ! is_bool( $is_viewable ) ) { |
| 2147 | | return false; |
| 2148 | | } |
| 2149 | | |
| 2150 | | return $is_viewable; |
| | 2149 | return true === apply_filters( 'is_post_type_viewable', $is_viewable, $post_type ); |
| 2151 | 2150 | } |
| 2152 | 2151 | |
| 2153 | 2152 | /** |