is_post_status_viewable()

最后更新于:2021-11-27 10:08:37

is_post_status_viewable( string|stdClass$post_status)

Determine whether a post status is considered “viewable”.

参数

$post_status

(string|stdClass) (Required) Post status name or object.

响应

(bool) Whether the post status should be considered viewable.

源文件

文件: gc-includes/post.php

function is_post_status_viewable( $post_status ) {
	if ( is_scalar( $post_status ) ) {
		$post_status = get_post_status_object( $post_status );
		if ( ! $post_status ) {
			return false;
		}
	}

	if (
		! is_object( $post_status ) ||
		$post_status->internal ||
		$post_status->protected
	) {
		return false;
	}

	return $post_status->publicly_queryable || ( $post_status->_builtin && $post_status->public );
}