Yoast\WP\SEO\Generators\Schema
Article::add_potential_action
Adds the potential action property to the Article Schema piece.
Метод класса: Article{}
Хуки из метода
Возвращает
Массив. The Article data with the potential action added.
Использование
// private - только в коде основоного (родительского) класса $result = $this->add_potential_action( $data );
- $data(массив) (обязательный)
- The Article data.
Код Article::add_potential_action() Article::add potential action Yoast 26.9
private function add_potential_action( $data ) {
/**
* Filter: 'wpseo_schema_article_potential_action_target' - Allows filtering of the schema Article potentialAction target.
*
* @param array $targets The URLs for the Article potentialAction target.
*/
$targets = \apply_filters( 'wpseo_schema_article_potential_action_target', [ $this->context->canonical . '#respond' ] );
$data['potentialAction'][] = [
'@type' => 'CommentAction',
'name' => 'Comment',
'target' => $targets,
];
return $data;
}