Yoast\WP\SEO\Abilities\Infrastructure

Post_SEO_Field_Map::to_seo_array │ public │ Yoast 1.0

Builds the post SEO data array from an indexable: the identity fields of the post, the shared SEO fields, then the post-only robots and schema fields.

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

Хуков нет.

Возвращает

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

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

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

Код Post_SEO_Field_Map::to_seo_array() Yoast 28.9

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

	return \array_merge(
		[
			'post_id'     => (int) $indexable->object_id,
			'post_title'  => $indexable->breadcrumb_title,
			'permalink'   => $indexable->permalink,
			'post_type'   => $indexable->object_sub_type,
			'post_status' => $indexable->post_status,
		],
		$this->get_shared_seo_fields( $indexable, $meta ),
		[
			'nofollow'            => (bool) $indexable->is_robots_nofollow,
			'noimageindex'        => (bool) $indexable->is_robots_noimageindex,
			'noarchive'           => (bool) $indexable->is_robots_noarchive,
			'nosnippet'           => (bool) $indexable->is_robots_nosnippet,
			'schema_page_type'    => $indexable->schema_page_type,
			'schema_article_type' => $indexable->schema_article_type,
		],
	);
}