Title: get_oembed_response_data_rich
Published: December 9, 2015
Last modified: February 24, 2026

---

# get_oembed_response_data_rich( array $data, WP_Post $post, int $width, int $height ): array

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/get_oembed_response_data_rich/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_oembed_response_data_rich/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_oembed_response_data_rich/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_oembed_response_data_rich/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_oembed_response_data_rich/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/get_oembed_response_data_rich/?output_format=md#wp--skip-link--target)

Filters the oEmbed response data to return an iframe embed code.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_oembed_response_data_rich/?output_format=md#parameters)󠁿

 `$data`arrayrequired

The response data.

`$post`[WP_Post](https://developer.wordpress.org/reference/classes/wp_post/)required

The post object.

`$width`intrequired

The requested width.

`$height`intrequired

The calculated height.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_oembed_response_data_rich/?output_format=md#return)󠁿

 array The modified response data.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_oembed_response_data_rich/?output_format=md#source)󠁿

    ```php
    function get_oembed_response_data_rich( $data, $post, $width, $height ) {
    	$data['width']  = absint( $width );
    	$data['height'] = absint( $height );
    	$data['type']   = 'rich';
    	$data['html']   = get_post_embed_html( $width, $height, $post );

    	// Add post thumbnail to response if available.
    	$thumbnail_id = false;

    	if ( has_post_thumbnail( $post->ID ) ) {
    		$thumbnail_id = get_post_thumbnail_id( $post->ID );
    	}

    	if ( 'attachment' === get_post_type( $post ) ) {
    		if ( wp_attachment_is_image( $post ) ) {
    			$thumbnail_id = $post->ID;
    		} elseif ( wp_attachment_is( 'video', $post ) ) {
    			$thumbnail_id = get_post_thumbnail_id( $post );
    			$data['type'] = 'video';
    		}
    	}

    	if ( $thumbnail_id ) {
    		list( $thumbnail_url, $thumbnail_width, $thumbnail_height ) = wp_get_attachment_image_src( $thumbnail_id, array( $width, 0 ) );
    		$data['thumbnail_url']                                      = $thumbnail_url;
    		$data['thumbnail_width']                                    = $thumbnail_width;
    		$data['thumbnail_height']                                   = $thumbnail_height;
    	}

    	return $data;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/embed.php#L719)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/embed.php#L719-L749)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_oembed_response_data_rich/?output_format=md#related)󠁿

| Uses | Description | 
| [get_post_embed_html()](https://developer.wordpress.org/reference/functions/get_post_embed_html/)`wp-includes/embed.php` |

Retrieves the embed code for a specific post.

  | 
| [wp_attachment_is()](https://developer.wordpress.org/reference/functions/wp_attachment_is/)`wp-includes/post.php` |

Verifies an attachment is of a given type.

  | 
| [has_post_thumbnail()](https://developer.wordpress.org/reference/functions/has_post_thumbnail/)`wp-includes/post-thumbnail-template.php` |

Determines whether a post has an image attached.

  | 
| [get_post_thumbnail_id()](https://developer.wordpress.org/reference/functions/get_post_thumbnail_id/)`wp-includes/post-thumbnail-template.php` |

Retrieves the post thumbnail ID.

  | 
| [wp_get_attachment_image_src()](https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src/)`wp-includes/media.php` |

Retrieves an image to represent an attachment.

  | 
| [wp_attachment_is_image()](https://developer.wordpress.org/reference/functions/wp_attachment_is_image/)`wp-includes/post.php` |

Determines whether an attachment is an image.

  | 
| [get_post_type()](https://developer.wordpress.org/reference/functions/get_post_type/)`wp-includes/post.php` |

Retrieves the post type of the current post or of a given post.

  | 
| [absint()](https://developer.wordpress.org/reference/functions/absint/)`wp-includes/load.php` |

Converts a value to non-negative integer.

  |

[Show 3 more](https://developer.wordpress.org/reference/functions/get_oembed_response_data_rich/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_oembed_response_data_rich/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_oembed_response_data_rich/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_oembed_response_data_rich%2F)
before being able to contribute a note or feedback.