is_post_status_viewable filter-hookWP 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.


Since 5.9.0 Introduced.

Where the hook is called

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

Where the hook is used in WordPress

Usage not found.