Yoast\WP\SEO\Generators

Schema_Generator::protected_webpage_schema()publicYoast 1.0

Adapts the WebPage graph piece for password-protected posts.

It should only have certain whitelisted properties. The type should always be WebPage.

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

Хуков нет.

Возвращает

Массив. The WebPage graph piece that has been adapted for password-protected posts.

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

$Schema_Generator = new Schema_Generator();
$Schema_Generator->protected_webpage_schema( $graph_piece );
$graph_piece(массив) (обязательный)
The WebPage graph piece that should be adapted for password-protected posts.

Код Schema_Generator::protected_webpage_schema() Yoast 22.3

public function protected_webpage_schema( $graph_piece ) {
	$properties_to_show = \array_flip(
		[
			'@type',
			'@id',
			'url',
			'name',
			'isPartOf',
			'inLanguage',
			'datePublished',
			'dateModified',
			'breadcrumb',
		]
	);

	$graph_piece          = \array_intersect_key( $graph_piece, $properties_to_show );
	$graph_piece['@type'] = 'WebPage';

	return $graph_piece;
}