get_oembed_response_data_rich

The timeline below displays how wordpress function get_oembed_response_data_rich has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.1

/**
 * Filters the oEmbed response data to return an iframe embed code.
 *
 * @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 array The modified response data.
 */
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, 99999));
        $data['thumbnail_url'] = $thumbnail_url;
        $data['thumbnail_width'] = $thumbnail_width;
        $data['thumbnail_height'] = $thumbnail_height;
    }
    return $data;
}

WordPress Version: 4.4

/**
 * Filters the oEmbed response data to return an iframe embed code.
 *
 * @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 array The modified response data.
 */
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;
        } else if (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, 99999));
        $data['thumbnail_url'] = $thumbnail_url;
        $data['thumbnail_width'] = $thumbnail_width;
        $data['thumbnail_height'] = $thumbnail_height;
    }
    return $data;
}