Yoast\WP\SEO\Builders

Indexable_Post_Builder::is_public()protectedYoast 1.0

Determines the value of is_public.

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

Хуков нет.

Возвращает

true|false|null. Whether or not the post type is public. Null if no override is set.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->is_public( $indexable );
$indexable(Indexable) (обязательный)
The indexable.

Код Indexable_Post_Builder::is_public() Yoast 22.4

protected function is_public( $indexable ) {
	if ( $indexable->is_protected === true ) {
		return false;
	}

	if ( $indexable->is_robots_noindex === true ) {
		return false;
	}

	// Attachments behave differently than the other post types, since they inherit from their parent.
	if ( $indexable->object_sub_type === 'attachment' ) {
		return $this->is_public_attachment( $indexable );
	}

	if ( ! \in_array( $indexable->post_status, $this->post_helper->get_public_post_statuses(), true ) ) {
		return false;
	}

	if ( $indexable->is_robots_noindex === false ) {
		return true;
	}

	return null;
}