Yoast\WP\SEO\Generators\Schema
Article::is_needed() public Yoast 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() Article::is needed Yoast 15.7
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->main_schema_id = $this->context->canonical . Schema_IDs::ARTICLE_HASH;
return true;
}
return false;
}