# get_oembed_response_data()

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

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

## Сигнатура

```php
get_oembed_response_data( WP_Post|int $post, int $width ): array|false
```

## Описание

Получает данные ответа oEmbed для заданной записи.

## Параметры

- `$post` `WP_Post|int` — обязательный. Идентификатор записи или объект записи.
- `$width` `int` — обязательный. Запрашиваемая ширина.

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

`array|false`

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

Файл: `wp-includes/embed.php:561`

```php
function get_oembed_response_data( $post, $width ) {
	$post  = get_post( $post );
	$width = absint( $width );

	if ( ! $post ) {
		return false;
	}

	if ( ! is_post_publicly_viewable( $post ) ) {
		return false;
	}

	if ( ! is_post_embeddable( $post ) ) {
		return false;
	}

	/**
	 * Filters the allowed minimum and maximum widths for the oEmbed response.
	 *
	 * @since 4.4.0
	 *
	 * @param array $min_max_width {
	 *     Minimum and maximum widths for the oEmbed response.
	 *
	 *     @type int $min Minimum width. Default 200.
	 *     @type int $max Maximum width. Default 600.
	 * }
	 */
	$min_max_width = apply_filters(
		'oembed_min_max_width',
		array(
			'min' => 200,
			'max' => 600,
		)
	);

	$width  = min( max( $min_max_width['min'], $width ), $min_max_width['max'] );
	$height = max( (int) ceil( $width / 16 * 9 ), 200 );

	$data = array(
		'version'       => '1.0',
		'provider_name' => get_bloginfo( 'name' ),
		'provider_url'  => get_home_url(),
		'author_name'   => get_bloginfo( 'name' ),
		'author_url'    => get_home_url(),
		'title'         => get_the_title( $post ),
		'type'          => 'link',
	);

	$author = get_userdata( $post->post_author );

	if ( $author ) {
		$data['author_name'] = $author->display_name;
		$data['author_url']  = get_author_posts_url( $author->ID );
	}

	/**
	 * Filters the oEmbed response data.
	 *
	 * @since 4.4.0
	 *
	 * @param array   $data   The response data.
	 * @param WP_Post $post   The post object.
	 * @param int     $width  The requested width.
	 * @param int     $height The calculated height.
	 */
	return apply_filters( 'oembed_response_data', $data, $post, $width, $height );
}
```

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

- 6.8.0 — Output was adjusted to only embed if the post type supports it.
- 4.4.0 — Introduced.

## Связанные

Использует: [`is_post_embeddable`](https://chugunov.pro/api-wordpress/functions/is_post_embeddable/), [`is_post_publicly_viewable`](https://chugunov.pro/api-wordpress/functions/is_post_publicly_viewable/), [`get_home_url`](https://chugunov.pro/api-wordpress/functions/get_home_url/), [`get_the_title`](https://chugunov.pro/api-wordpress/functions/get_the_title/), [`get_author_posts_url`](https://chugunov.pro/api-wordpress/functions/get_author_posts_url/), [`get_userdata`](https://chugunov.pro/api-wordpress/functions/get_userdata/), [`get_bloginfo`](https://chugunov.pro/api-wordpress/functions/get_bloginfo/), [`absint`](https://chugunov.pro/api-wordpress/functions/absint/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/), [`get_post`](https://chugunov.pro/api-wordpress/functions/get_post/).
Используется в: [`get_oembed_response_data_for_url`](https://chugunov.pro/api-wordpress/functions/get_oembed_response_data_for_url/), `WP_oEmbed_Controller::get_item`.

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