apply_filters( 'is_post_type_viewable', bool $is_viewable, WP_Post_Type $post_type )

Filters whether a post type is considered “viewable”.


The returned filtered value must be a boolean type to ensure is_post_type_viewable() only 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.

Top ↑


$is_viewable bool
Whether the post type is "viewable" (strict type).
$post_type WP_Post_Type
Post type object.

Top ↑


File: wp-includes/post.php. View all references

return true === apply_filters( 'is_post_type_viewable', $is_viewable, $post_type );

Top ↑


Version Description
5.9.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.