Yoast\WP\SEO\Generators\Schema
WebPage::add_author
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() WebPage::add author Yoast 27.7
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;
}