WordPress at a glance
function is not described

is_post_publicly_viewable() WP 5.7.0

Determine whether a post is publicly viewable.

Posts are considered publicly viewable if both the post status and post type are viewable.

No Hooks.

Return

true|false. Whether the post is publicly viewable.

Usage

is_post_publicly_viewable( $post );
$post(int|WP_Post|null)
Post ID or post object.
Default: global $post

Changelog

Since 5.7.0 Introduced.

Code of is_post_publicly_viewable() WP 5.7.1

<?php
function is_post_publicly_viewable( $post = null ) {
	$post = get_post( $post );

	if ( ! $post ) {
		return false;
	}

	$post_type   = get_post_type( $post );
	$post_status = get_post_status( $post );

	return is_post_type_viewable( $post_type ) && is_post_status_viewable( $post_status );
}