# previous_post()

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

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

> Устаревший элемент. Помечен устаревшим с версии 2.0.0.

## Сигнатура

```php
previous_post( string $format = '%', string $previous = 'previous post: ', string $title = 'yes', string $in_same_cat = 'no', int $limitprev = 1, string $excluded_categories = '' )
```

## Описание

См. alsoprevious_post_link()

## Параметры

- `$format` `string` — необязательный, по умолчанию `'%'`. Default:'%'
- `$previous` `string` — необязательный, по умолчанию `'previous post: '`. Default:'previous post: '
- `$title` `string` — необязательный, по умолчанию `'yes'`. Default:'yes'
- `$in_same_cat` `string` — необязательный, по умолчанию `'no'`. Default:'no'
- `$limitprev` `int` — необязательный, по умолчанию `1`. Default:1
- `$excluded_categories` `string` — необязательный, по умолчанию `''`. Default:''

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

Файл: `wp-includes/deprecated.php:137`

```php
function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {

	_deprecated_function( __FUNCTION__, '2.0.0', 'previous_post_link()' );

	if ( empty($in_same_cat) || 'no' == $in_same_cat )
		$in_same_cat = false;
	else
		$in_same_cat = true;

	$post = get_previous_post($in_same_cat, $excluded_categories);

	if ( !$post )
		return;

	$string = '<a href="'.get_permalink($post->ID).'">'.$previous;
	if ( 'yes' == $title )
		/** This filter is documented in wp-includes/post-template.php */
		$string .= apply_filters('the_title', $post->post_title, $post->ID);
	$string .= '</a>';
	$format = str_replace('%', $string, $format);
	echo $format;
}
```

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

- 2.0.0 — Deprecated. Use previous_post_link()
- 1.5.0 — Introduced.

## Связанные

Использует: [`get_previous_post`](https://chugunov.pro/api-wordpress/functions/get_previous_post/), [`_deprecated_function`](https://chugunov.pro/api-wordpress/functions/_deprecated_function/), [`get_permalink`](https://chugunov.pro/api-wordpress/functions/get_permalink/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).

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