is_post_publicly_viewable() – Determine whether a post is publicly viewable.
You appear to be a bot. Output may be restricted
Description
Determine whether a post is publicly viewable.
Posts are considered publicly viewable if both the post status and post type are viewable.
Usage
$bool = is_post_publicly_viewable( $post );
Parameters
- $post
- ( int|WP_Post|null ) optional – Optional. Post ID or post object. Defaults to global $post.
Returns
bool Whether the post is publicly viewable.
Source
File name: wordpress/wp-includes/post.php
Lines:
1 to 12 of 12
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 ); }