WPSEO_Sitemap_Image_Parser::get_gallery_attachments()protectedYoast 1.0

Returns the attachments for a gallery.

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

Хуков нет.

Возвращает

Массив. The selected attachments.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_gallery_attachments( $id, $gallery );
$id(int) (обязательный)
The post ID.
$gallery(массив) (обязательный)
The gallery config.

Код WPSEO_Sitemap_Image_Parser::get_gallery_attachments() Yoast 22.3

protected function get_gallery_attachments( $id, $gallery ) {

	// When there are attachments to include.
	if ( ! empty( $gallery['include'] ) ) {
		return $this->get_gallery_attachments_for_included( $gallery['include'] );
	}

	// When $id is empty, just return empty array.
	if ( empty( $id ) ) {
		return [];
	}

	return $this->get_gallery_attachments_for_parent( $id, $gallery );
}