# wp_queue_posts_for_term_meta_lazyload()

URL: https://chugunov.pro/api-wordpress/functions/wp_queue_posts_for_term_meta_lazyload/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 4.5.0.

## Сигнатура

```php
wp_queue_posts_for_term_meta_lazyload( WP_Post[] $posts )
```

## Описание

Ставит записи в очередь для отложенной загрузки метаданных терминов.

## Параметры

- `$posts` `WP_Post[]` — обязательный. Массив объектов WP_Post.

## Исходный код

Файл: `wp-includes/post.php:8168`

```php
function wp_queue_posts_for_term_meta_lazyload( $posts ) {
	$post_type_taxonomies = array();
	$prime_post_terms     = array();
	foreach ( $posts as $post ) {
		if ( ! ( $post instanceof WP_Post ) ) {
			continue;
		}

		if ( ! isset( $post_type_taxonomies[ $post->post_type ] ) ) {
			$post_type_taxonomies[ $post->post_type ] = get_object_taxonomies( $post->post_type );
		}

		foreach ( $post_type_taxonomies[ $post->post_type ] as $taxonomy ) {
			$prime_post_terms[ $taxonomy ][] = $post->ID;
		}
	}

	$term_ids = array();
	if ( $prime_post_terms ) {
		foreach ( $prime_post_terms as $taxonomy => $post_ids ) {
			$cached_term_ids = wp_cache_get_multiple( $post_ids, "{$taxonomy}_relationships" );
			if ( is_array( $cached_term_ids ) ) {
				$cached_term_ids = array_filter( $cached_term_ids );
				foreach ( $cached_term_ids as $_term_ids ) {
					// Backward compatibility for if a plugin is putting objects into the cache, rather than IDs.
					foreach ( $_term_ids as $term_id ) {
						if ( is_numeric( $term_id ) ) {
							$term_ids[] = (int) $term_id;
						} elseif ( isset( $term_id->term_id ) ) {
							$term_ids[] = (int) $term_id->term_id;
						}
					}
				}
			}
		}
		$term_ids = array_unique( $term_ids );
	}

	wp_lazyload_term_meta( $term_ids );
}
```

## История изменений

- 4.5.0 — Introduced.

## Связанные

Использует: [`wp_lazyload_term_meta`](https://chugunov.pro/api-wordpress/functions/wp_lazyload_term_meta/), [`wp_cache_get_multiple`](https://chugunov.pro/api-wordpress/functions/wp_cache_get_multiple/), [`get_object_taxonomies`](https://chugunov.pro/api-wordpress/functions/get_object_taxonomies/).
Используется в: `WP_Query::get_posts`.

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/wp_queue_posts_for_term_meta_lazyload/
