WPSEO_Sitemap_Image_Parser::get_gallery_attachments_for_included()protectedYoast 1.0

Returns an array with attachments for the post IDs that will be included.

{} Это метод класса: WPSEO_Sitemap_Image_Parser{}

Хуков нет.

Возвращает

Массив. The found attachments.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_gallery_attachments_for_included( $included_ids );
$included_ids(массив) (обязательный)
Array with IDs to include.

Код WPSEO_Sitemap_Image_Parser::get_gallery_attachments_for_included() Yoast 18.8

protected function get_gallery_attachments_for_included( $included_ids ) {
	$ids_to_include = wp_parse_id_list( $included_ids );
	$attachments    = $this->get_attachments(
		[
			'posts_per_page' => count( $ids_to_include ),
			'post__in'       => $ids_to_include,
		]
	);

	$gallery_attachments = [];
	foreach ( $attachments as $key => $val ) {
		$gallery_attachments[ $val->ID ] = $val;
	}

	return $gallery_attachments;
}