diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index 91edacf76f..94f5b838e9 100644
a
|
b
|
function is_post_type_viewable( $post_type ) { |
2108 | 2108 | /** |
2109 | 2109 | * Filters whether a post type is considered "viewable". |
2110 | 2110 | * |
| 2111 | * To avoid the potential for type errors in PHP 8.1 or later, this filter |
| 2112 | * must return a boolean true for the post type to be considered viewable. |
| 2113 | * |
| 2114 | * All other values (even truthy values) will result in the function |
| 2115 | * is_post_type_viewable() returning false. |
| 2116 | * |
2111 | 2117 | * @since 5.9.0 |
2112 | 2118 | * |
2113 | 2119 | * @param bool $is_viewable Whether the post type is "viewable". |
2114 | 2120 | * @param WP_Post_Type $post_type Post type object. |
2115 | 2121 | */ |
2116 | | $is_viewable = apply_filters( 'is_post_type_viewable', $is_viewable, $post_type ); |
2117 | | |
2118 | | // Make sure the filtered value is a boolean type before returning it. |
2119 | | if ( ! is_bool( $is_viewable ) ) { |
2120 | | return false; |
2121 | | } |
2122 | | |
2123 | | return $is_viewable; |
| 2122 | return true === apply_filters( 'is_post_type_viewable', $is_viewable, $post_type ); |
2124 | 2123 | } |
2125 | 2124 | |
2126 | 2125 | /** |