Yoast\WP\SEO\Generators\Schema

Article::is_needed()publicYoast 1.0

Determines whether or not a piece should be added to the graph.

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

Хуков нет.

Возвращает

true|false.

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

$Article = new Article();
$Article->is_needed();

Код Article::is_needed() Yoast 22.3

public function is_needed() {
	if ( $this->context->indexable->object_type !== 'post' ) {
		return false;
	}

	// If we cannot output a publisher, we shouldn't output an Article.
	if ( $this->context->site_represents === false ) {
		return false;
	}

	// If we cannot output an author, we shouldn't output an Article.
	if ( ! $this->helpers->schema->article->is_author_supported( $this->context->indexable->object_sub_type ) ) {
		return false;
	}

	if ( $this->context->schema_article_type !== 'None' ) {
		$this->context->has_article = true;
		return true;
	}

	return false;
}