is_post_status_viewable хук-фильтрWP 5.9.0

Filters whether a post status is considered "viewable".

The returned filtered value must be a boolean type to ensure is_post_status_viewable() returns a boolean. This strictness is by design to maintain backwards-compatibility and guard against potential type errors in PHP 8.1+. Non-boolean values (even falsey and truthy values) will result in the function returning false.


add_filter( 'is_post_status_viewable', 'wp_kama_is_post_status_viewable_filter', 10, 2 );

 * Function for `is_post_status_viewable` filter-hook.
 * @param bool     $is_viewable Whether the post status is "viewable" (strict type).
 * @param stdClass $post_status Post status object.
 * @return bool
function wp_kama_is_post_status_viewable_filter( $is_viewable, $post_status ){

	// filter...
	return $is_viewable;
Whether the post status is "viewable" (strict type).
Post status object.

Список изменений

С версии 5.9.0 Введена.

Где вызывается хук

wp-includes/post.php 2316
return true === apply_filters( 'is_post_status_viewable', $is_viewable, $post_status );

Где используется хук в WordPress

Использование не найдено.