# get_feed_link()

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

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

## Сигнатура

```php
get_feed_link( string $feed = '' ): string
```

## Описание

Извлекает постоянную ссылку для типа ленты.

## Параметры

- `$feed` `string` — необязательный, по умолчанию `''`. Тип ленты. Возможные значения: 'rss2', 'atom'.
  
  По умолчанию — значение get_default_feed() .

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

`string`

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

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

```php
function get_feed_link( $feed = '' ) {
	global $wp_rewrite;

	$permalink = $wp_rewrite->get_feed_permastruct();

	if ( $permalink ) {
		if ( str_contains( $feed, 'comments_' ) ) {
			$feed      = str_replace( 'comments_', '', $feed );
			$permalink = $wp_rewrite->get_comment_feed_permastruct();
		}

		if ( get_default_feed() === $feed ) {
			$feed = '';
		}

		$permalink = str_replace( '%feed%', $feed, $permalink );
		$permalink = preg_replace( '#/+#', '/', "/$permalink" );
		$output    = home_url( user_trailingslashit( $permalink, 'feed' ) );
	} else {
		if ( empty( $feed ) ) {
			$feed = get_default_feed();
		}

		if ( str_contains( $feed, 'comments_' ) ) {
			$feed = str_replace( 'comments_', 'comments-', $feed );
		}

		$output = home_url( "?feed={$feed}" );
	}

	/**
	 * Filters the feed type permalink.
	 *
	 * @since 1.5.0
	 *
	 * @param string $output The feed permalink.
	 * @param string $feed   The feed type. Possible values include 'rss2', 'atom',
	 *                       or an empty string for the default feed type.
	 */
	return apply_filters( 'feed_link', $output, $feed );
}
```

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

- 1.5.0 — Introduced.

## Связанные

Использует: [`user_trailingslashit`](https://chugunov.pro/api-wordpress/functions/user_trailingslashit/), [`get_default_feed`](https://chugunov.pro/api-wordpress/functions/get_default_feed/), `WP_Rewrite::get_feed_permastruct`, `WP_Rewrite::get_comment_feed_permastruct`, [`home_url`](https://chugunov.pro/api-wordpress/functions/home_url/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).
Используется в: [`feed_links`](https://chugunov.pro/api-wordpress/functions/feed_links/), [`get_bloginfo`](https://chugunov.pro/api-wordpress/functions/get_bloginfo/), [`the_feed_link`](https://chugunov.pro/api-wordpress/functions/the_feed_link/), [`redirect_canonical`](https://chugunov.pro/api-wordpress/functions/redirect_canonical/).

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