Yoast\WP\SEO\Generators\Schema

Article::add_potential_action()privateYoast 1.0

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() Yoast 22.4

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;
}