Yoast\WP\SEO\Abilities\Infrastructure

Term_SEO_Field_Map::to_seo_array │ public │ Yoast 1.0

Builds the term SEO data array from an indexable: the identity fields of the term, then the shared SEO fields.

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

Хуков нет.

Возвращает

array<string, int|string|bool|null>. The term SEO data, keyed by output-schema property name.

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

$Term_SEO_Field_Map = new Term_SEO_Field_Map();
$Term_SEO_Field_Map->to_seo_array( $indexable ): array;
$indexable(Indexable) (обязательный)
The indexable to read from.

Код Term_SEO_Field_Map::to_seo_array() Yoast 28.9

public function to_seo_array( $indexable ): array {
	$meta = $this->meta_surface->for_indexable( $indexable, 'Term_Archive' );

	return \array_merge(
		[
			'term_id'   => (int) $indexable->object_id,
			'term_name' => $indexable->breadcrumb_title,
			'permalink' => $indexable->permalink,
			'taxonomy'  => $indexable->object_sub_type,
		],
		$this->get_shared_seo_fields( $indexable, $meta ),
	);
}