Changeset 52045
- Timestamp:
- 11/08/2021 03:33:10 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r52043 r52045 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
Note: See TracChangeset
for help on using the changeset viewer.