Yoast\WP\SEO\Task_List\Infrastructure\Indexables

Recent_Content_Indexable_Collector::get_recent_content_for_meta_descriptionspublicYoast 1.0

Gets recent content items for the meta descriptions task for the given post type.

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

Хуков нет.

Возвращает

Meta_Description_Content_Item_Data[]. Array of content item data value objects.

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

$Recent_Content_Indexable_Collector = new Recent_Content_Indexable_Collector();
$Recent_Content_Indexable_Collector->get_recent_content_for_meta_descriptions( $post_type, $date_limit, ?int $limit ): array;
$post_type(строка) (обязательный)
The post type to query.
$date_limit(строка) (обязательный)
The date limit (content modified after this date).
?int $limit
.
По умолчанию: null

Код Recent_Content_Indexable_Collector::get_recent_content_for_meta_descriptions() Yoast 27.8

public function get_recent_content_for_meta_descriptions( string $post_type, string $date_limit, ?int $limit = null ): array {
	$raw_results = $this->indexable_repository->get_recent_posts_for_post_type(
		$post_type,
		$limit,
		$date_limit,
	);

	if ( ! \is_array( $raw_results ) ) {
		return [];
	}

	$content_items = [];

	foreach ( $raw_results as $result ) {
		$content_items[] = new Meta_Description_Content_Item_Data(
			(int) $result['object_id'],
			$result['breadcrumb_title'],
			(string) $result['description'] !== '',
		);
	}

	return $content_items;
}