Yoast\WP\SEO\Generators\Schema

WebPage::add_author()publicYoast 1.0

Adds an author property to the $data if the WebPage is not represented.

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

Хуков нет.

Возвращает

Массив<Строку|Массив<Строку>>. The WebPage schema.

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

$WebPage = new WebPage();
$WebPage->add_author( $data, $post );
$data(array<string|array>) (обязательный)
The WebPage schema.
$post(WP_Post) (обязательный)
The post the context is representing.

Код WebPage::add_author() Yoast 22.4

public function add_author( $data, $post ) {
	if ( $this->context->site_represents === false ) {
		$data['author'] = [ '@id' => $this->helpers->schema->id->get_user_schema_id( $post->post_author, $this->context ) ];
	}

	return $data;
}