WPSEO_Slug_Change_Watcher::is_post_viewable()protectedYoast 1.0

Checks if the post is viewable.

Метод класса: WPSEO_Slug_Change_Watcher{}

Хуков нет.

Возвращает

true|false. Whether the post is viewable or not.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->is_post_viewable( $post_id );
$post_id(строка) (обязательный)
The post id to check.

Код WPSEO_Slug_Change_Watcher::is_post_viewable() Yoast 22.4

protected function is_post_viewable( $post_id ) {
	$post_type = get_post_type( $post_id );
	if ( ! WPSEO_Post_Type::is_post_type_accessible( $post_type ) ) {
		return false;
	}

	$post_status = get_post_status( $post_id );
	if ( ! $this->check_visible_post_status( $post_status ) ) {
		return false;
	}

	return true;
}