# get_next_posts_link()

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

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

## Сигнатура

```php
get_next_posts_link( string $label = null, int $max_page ): string|null
```

## Описание

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

## Параметры

- `$label` `string` — необязательный, по умолчанию `null`. Содержимое для текста ссылки.
- `$max_page` `int` — необязательный. Максимальное число страниц. По умолчанию 0.

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

`string|null`

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

Файл: `wp-includes/link-template.php:2567`

```php
function get_next_posts_link( $label = null, $max_page = 0 ) {
	global $paged, $wp_query;

	if ( ! $max_page ) {
		$max_page = $wp_query->max_num_pages;
	}

	if ( ! $paged ) {
		$paged = 1;
	}

	$next_page = (int) $paged + 1;

	if ( null === $label ) {
		$label = __( 'Next Page &raquo;' );
	}

	if ( ! is_single() && ( $next_page <= $max_page ) ) {
		/**
		 * Filters the anchor tag attributes for the next posts page link.
		 *
		 * @since 2.7.0
		 *
		 * @param string $attributes Attributes for the anchor tag.
		 */
		$attr = apply_filters( 'next_posts_link_attributes', '' );

		return sprintf(
			'<a href="%1$s" %2$s>%3$s</a>',
			next_posts( $max_page, false ),
			$attr,
			preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label )
		);
	}
}
```

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

- 2.7.0 — Introduced.

## Связанные

Использует: [`is_single`](https://chugunov.pro/api-wordpress/functions/is_single/), [`next_posts`](https://chugunov.pro/api-wordpress/functions/next_posts/), [`__`](https://chugunov.pro/api-wordpress/functions/__/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).
Используется в: [`get_the_posts_navigation`](https://chugunov.pro/api-wordpress/functions/get_the_posts_navigation/), [`next_posts_link`](https://chugunov.pro/api-wordpress/functions/next_posts_link/), [`get_posts_nav_link`](https://chugunov.pro/api-wordpress/functions/get_posts_nav_link/).

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