Changeset 52043
- Timestamp:
- 11/08/2021 03:20:51 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r52041 r52043 2158 2158 * 2159 2159 * @since 5.7.0 2160 * @since 5.9.0 Added `is_post_status_viewable` hook to filter the result. 2160 2161 * 2161 2162 * @param string|stdClass $post_status Post status name or object. … … 2178 2179 } 2179 2180 2180 return $post_status->publicly_queryable || ( $post_status->_builtin && $post_status->public ); 2181 $is_viewable = $post_status->publicly_queryable || ( $post_status->_builtin && $post_status->public ); 2182 2183 /** 2184 * Filters whether a post status is considered "viewable". 2185 * 2186 * The returned filtered value must be a boolean type to ensure 2187 * `is_post_status_viewable()` only returns a boolean. This strictness 2188 * is by design to maintain backwards-compatibility and guard against 2189 * potential type errors in PHP 8.1+. Non-boolean values (even falsey 2190 * and truthy values) will result in the function returning false. 2191 * 2192 * @since 5.9.0 2193 * 2194 * @param bool $is_viewable Whether the post status is "viewable" (strict type). 2195 * @param stdClass $post_status Post status object. 2196 */ 2197 return true === apply_filters( 'is_post_status_viewable', $is_viewable, $post_status ); 2181 2198 } 2182 2199
Note: See TracChangeset
for help on using the changeset viewer.