Yoast\WP\SEO\Generators\Schema
Author::generate
Returns Person Schema data.
Метод класса: Author{}
Хуков нет.
Возвращает
true|false|Массив. Person data on success, false on failure.
Использование
$Author = new Author(); $Author->generate();
Код Author::generate() Author::generate Yoast 26.9
public function generate() {
$user_id = $this->determine_user_id();
if ( ! $user_id ) {
return false;
}
$data = $this->build_person_data( $user_id );
if ( $this->site_represents_current_author() === false ) {
$data['@type'] = [ 'Person' ];
unset( $data['logo'] );
}
// If this is an author page, the Person object is the main object, so we set it as such here.
if ( $this->context->indexable->object_type === 'user' ) {
$data['mainEntityOfPage'] = [
'@id' => $this->context->main_schema_id,
];
}
// If this is a post and the author archives are enabled, set the author archive url as the author url.
if ( $this->context->indexable->object_type === 'post' ) {
if ( $this->helpers->options->get( 'disable-author' ) !== true ) {
$data['url'] = $this->helpers->user->get_the_author_posts_url( $user_id );
}
}
return $data;
}