WPSEO_Sitemap_Image_Parser::get_gallery_attachments_for_parent
Returns the attachments for the given ID.
Метод класса: WPSEO_Sitemap_Image_Parser{}
Хуков нет.
Возвращает
Массив. The selected attachments.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_gallery_attachments_for_parent( $id, $gallery );
- $id(int) (обязательный)
- The post ID.
- $gallery(массив) (обязательный)
- The gallery config.
Код WPSEO_Sitemap_Image_Parser::get_gallery_attachments_for_parent() WPSEO Sitemap Image Parser::get gallery attachments for parent Yoast 27.3
protected function get_gallery_attachments_for_parent( $id, $gallery ) {
$query = [
'posts_per_page' => -1,
'post_parent' => $id,
];
// When there are posts that should be excluded from result set.
if ( ! empty( $gallery['exclude'] ) ) {
$query['post__not_in'] = wp_parse_id_list( $gallery['exclude'] );
}
return $this->get_attachments( $query );
}