# get_the_term_list()

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

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

## Сигнатура

```php
get_the_term_list( int $post_id, string $taxonomy, string $before = '', string $sep = '', string $after = '' ): string|false|WP_Error
```

## Описание

Термины ведут ссылками на соответствующие страницы со списком записей термина.

## Параметры

- `$post_id` `int` — обязательный. Идентификатор записи.
- `$taxonomy` `string` — обязательный. Имя таксономии.
- `$before` `string` — необязательный, по умолчанию `''`. Строка, вставляемая перед терминами.
- `$sep` `string` — необязательный, по умолчанию `''`. Строка, вставляемая между терминами.
- `$after` `string` — необязательный, по умолчанию `''`. Строка, вставляемая после терминов.

## Возвращаемое значение

`string|false|WP_Error` — WP_Error

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

Файл: `wp-includes/category-template.php:1338`

```php
function get_the_term_list( $post_id, $taxonomy, $before = '', $sep = '', $after = '' ) {
	$terms = get_the_terms( $post_id, $taxonomy );

	if ( is_wp_error( $terms ) ) {
		return $terms;
	}

	if ( empty( $terms ) ) {
		return false;
	}

	$links = array();

	foreach ( $terms as $term ) {
		$link = get_term_link( $term, $taxonomy );
		if ( is_wp_error( $link ) ) {
			return $link;
		}
		$links[] = '<a href="' . esc_url( $link ) . '" rel="tag">' . $term->name . '</a>';
	}

	/**
	 * Filters the term links for a given taxonomy.
	 *
	 * The dynamic portion of the hook name, `$taxonomy`, refers
	 * to the taxonomy slug.
	 *
	 * Possible hook names include:
	 *
	 *  - `term_links-category`
	 *  - `term_links-post_tag`
	 *  - `term_links-post_format`
	 *
	 * @since 2.5.0
	 *
	 * @param string[] $links An array of term links.
	 */
	$term_links = apply_filters( "term_links-{$taxonomy}", $links );  // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores

	return $before . implode( $sep, $term_links ) . $after;
}
```

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

- 2.5.0 — Introduced.

## Связанные

Использует: [`get_the_terms`](https://chugunov.pro/api-wordpress/functions/get_the_terms/), [`get_term_link`](https://chugunov.pro/api-wordpress/functions/get_term_link/), [`esc_url`](https://chugunov.pro/api-wordpress/functions/esc_url/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/), [`is_wp_error`](https://chugunov.pro/api-wordpress/functions/is_wp_error/).
Используется в: [`the_terms`](https://chugunov.pro/api-wordpress/functions/the_terms/), [`get_the_tag_list`](https://chugunov.pro/api-wordpress/functions/get_the_tag_list/).

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