# get_the_excerpt()

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

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

## Сигнатура

```php
get_the_excerpt( int|WP_Post|null $post = null ): string
```

## Описание

Получает отрывок записи.

## Параметры

- `$post` `int|WP_Post|null` — необязательный, по умолчанию `null`. ID записи или объект WP_Post. По умолчанию — глобальная переменная $post.

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

`string`

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

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

```php
function get_the_excerpt( $post = null ) {
	if ( is_bool( $post ) ) {
		_deprecated_argument( __FUNCTION__, '2.3.0' );
	}

	$post = get_post( $post );
	if ( empty( $post ) ) {
		return '';
	}

	if ( post_password_required( $post ) ) {
		return __( 'There is no excerpt because this is a protected post.' );
	}

	/**
	 * Filters the retrieved post excerpt.
	 *
	 * @since 1.2.0
	 * @since 4.5.0 Introduced the `$post` parameter.
	 *
	 * @param string  $post_excerpt The post excerpt.
	 * @param WP_Post $post         Post object.
	 */
	return apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );
}
```

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

- 4.5.0 — Introduced the $post parameter.
- 0.71 — Introduced.

## Связанные

Использует: [`post_password_required`](https://chugunov.pro/api-wordpress/functions/post_password_required/), [`__`](https://chugunov.pro/api-wordpress/functions/__/), [`_deprecated_argument`](https://chugunov.pro/api-wordpress/functions/_deprecated_argument/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/), [`get_post`](https://chugunov.pro/api-wordpress/functions/get_post/).
Используется в: [`the_excerpt_embed`](https://chugunov.pro/api-wordpress/functions/the_excerpt_embed/), `WP_Posts_List_Table::column_title`, [`the_excerpt_rss`](https://chugunov.pro/api-wordpress/functions/the_excerpt_rss/), [`the_excerpt`](https://chugunov.pro/api-wordpress/functions/the_excerpt/).

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