_wp_post_thumbnail_html

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

WordPress Version: 5.9

/**
 * Returns HTML for the post thumbnail meta box.
 *
 * @since 2.9.0
 *
 * @param int|null         $thumbnail_id Optional. Thumbnail attachment ID. Default null.
 * @param int|WP_Post|null $post         Optional. The post ID or object associated
 *                                       with the thumbnail. Defaults to global $post.
 * @return string The post thumbnail HTML.
 */
function _wp_post_thumbnail_html($thumbnail_id = null, $post = null)
{
    $_wp_additional_image_sizes = wp_get_additional_image_sizes();
    $post = get_post($post);
    $post_type_object = get_post_type_object($post->post_type);
    $set_thumbnail_link = '<p class="hide-if-no-js"><a href="%s" id="set-post-thumbnail"%s class="thickbox">%s</a></p>';
    $upload_iframe_src = get_upload_iframe_src('image', $post->ID);
    $content = sprintf(
        $set_thumbnail_link,
        esc_url($upload_iframe_src),
        '',
        // Empty when there's no featured image set, `aria-describedby` attribute otherwise.
        esc_html($post_type_object->labels->set_featured_image)
    );
    if ($thumbnail_id && get_post($thumbnail_id)) {
        $size = isset($_wp_additional_image_sizes['post-thumbnail']) ? 'post-thumbnail' : array(266, 266);
        /**
         * Filters the size used to display the post thumbnail image in the 'Featured image' meta box.
         *
         * Note: When a theme adds 'post-thumbnail' support, a special 'post-thumbnail'
         * image size is registered, which differs from the 'thumbnail' image size
         * managed via the Settings > Media screen.
         *
         * @since 4.4.0
         *
         * @param string|int[] $size         Requested image size. Can be any registered image size name, or
         *                                   an array of width and height values in pixels (in that order).
         * @param int          $thumbnail_id Post thumbnail attachment ID.
         * @param WP_Post      $post         The post object associated with the thumbnail.
         */
        $size = apply_filters('admin_post_thumbnail_size', $size, $thumbnail_id, $post);
        $thumbnail_html = wp_get_attachment_image($thumbnail_id, $size);
        if (!empty($thumbnail_html)) {
            $content = sprintf($set_thumbnail_link, esc_url($upload_iframe_src), ' aria-describedby="set-post-thumbnail-desc"', $thumbnail_html);
            $content .= '<p class="hide-if-no-js howto" id="set-post-thumbnail-desc">' . __('Click the image to edit or update') . '</p>';
            $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail">' . esc_html($post_type_object->labels->remove_featured_image) . '</a></p>';
        }
    }
    $content .= '<input type="hidden" id="_thumbnail_id" name="_thumbnail_id" value="' . esc_attr($thumbnail_id ? $thumbnail_id : '-1') . '" />';
    /**
     * Filters the admin post thumbnail HTML markup to return.
     *
     * @since 2.9.0
     * @since 3.5.0 Added the `$post_id` parameter.
     * @since 4.6.0 Added the `$thumbnail_id` parameter.
     *
     * @param string   $content      Admin post thumbnail HTML markup.
     * @param int      $post_id      Post ID.
     * @param int|null $thumbnail_id Thumbnail attachment ID, or null if there isn't one.
     */
    return apply_filters('admin_post_thumbnail_html', $content, $post->ID, $thumbnail_id);
}

WordPress Version: 5.6

/**
 * Returns HTML for the post thumbnail meta box.
 *
 * @since 2.9.0
 *
 * @param int         $thumbnail_id ID of the attachment used for thumbnail
 * @param int|WP_Post $post         Optional. The post ID or object associated with the thumbnail, defaults to global $post.
 * @return string The post thumbnail HTML.
 */
function _wp_post_thumbnail_html($thumbnail_id = null, $post = null)
{
    $_wp_additional_image_sizes = wp_get_additional_image_sizes();
    $post = get_post($post);
    $post_type_object = get_post_type_object($post->post_type);
    $set_thumbnail_link = '<p class="hide-if-no-js"><a href="%s" id="set-post-thumbnail"%s class="thickbox">%s</a></p>';
    $upload_iframe_src = get_upload_iframe_src('image', $post->ID);
    $content = sprintf(
        $set_thumbnail_link,
        esc_url($upload_iframe_src),
        '',
        // Empty when there's no featured image set, `aria-describedby` attribute otherwise.
        esc_html($post_type_object->labels->set_featured_image)
    );
    if ($thumbnail_id && get_post($thumbnail_id)) {
        $size = isset($_wp_additional_image_sizes['post-thumbnail']) ? 'post-thumbnail' : array(266, 266);
        /**
         * Filters the size used to display the post thumbnail image in the 'Featured image' meta box.
         *
         * Note: When a theme adds 'post-thumbnail' support, a special 'post-thumbnail'
         * image size is registered, which differs from the 'thumbnail' image size
         * managed via the Settings > Media screen.
         *
         * @since 4.4.0
         *
         * @param string|int[] $size         Requested image size. Can be any registered image size name, or
         *                                   an array of width and height values in pixels (in that order).
         * @param int          $thumbnail_id Post thumbnail attachment ID.
         * @param WP_Post      $post         The post object associated with the thumbnail.
         */
        $size = apply_filters('admin_post_thumbnail_size', $size, $thumbnail_id, $post);
        $thumbnail_html = wp_get_attachment_image($thumbnail_id, $size);
        if (!empty($thumbnail_html)) {
            $content = sprintf($set_thumbnail_link, esc_url($upload_iframe_src), ' aria-describedby="set-post-thumbnail-desc"', $thumbnail_html);
            $content .= '<p class="hide-if-no-js howto" id="set-post-thumbnail-desc">' . __('Click the image to edit or update') . '</p>';
            $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail">' . esc_html($post_type_object->labels->remove_featured_image) . '</a></p>';
        }
    }
    $content .= '<input type="hidden" id="_thumbnail_id" name="_thumbnail_id" value="' . esc_attr($thumbnail_id ? $thumbnail_id : '-1') . '" />';
    /**
     * Filters the admin post thumbnail HTML markup to return.
     *
     * @since 2.9.0
     * @since 3.5.0 Added the `$post_id` parameter.
     * @since 4.6.0 Added the `$thumbnail_id` parameter.
     *
     * @param string   $content      Admin post thumbnail HTML markup.
     * @param int      $post_id      Post ID.
     * @param int|null $thumbnail_id Thumbnail attachment ID, or null if there isn't one.
     */
    return apply_filters('admin_post_thumbnail_html', $content, $post->ID, $thumbnail_id);
}

WordPress Version: 5.5

/**
 * Returns HTML for the post thumbnail meta box.
 *
 * @since 2.9.0
 *
 * @param int         $thumbnail_id ID of the attachment used for thumbnail
 * @param int|WP_Post $post         Optional. The post ID or object associated with the thumbnail, defaults to global $post.
 * @return string The post thumbnail HTML.
 */
function _wp_post_thumbnail_html($thumbnail_id = null, $post = null)
{
    $_wp_additional_image_sizes = wp_get_additional_image_sizes();
    $post = get_post($post);
    $post_type_object = get_post_type_object($post->post_type);
    $set_thumbnail_link = '<p class="hide-if-no-js"><a href="%s" id="set-post-thumbnail"%s class="thickbox">%s</a></p>';
    $upload_iframe_src = get_upload_iframe_src('image', $post->ID);
    $content = sprintf(
        $set_thumbnail_link,
        esc_url($upload_iframe_src),
        '',
        // Empty when there's no featured image set, `aria-describedby` attribute otherwise.
        esc_html($post_type_object->labels->set_featured_image)
    );
    if ($thumbnail_id && get_post($thumbnail_id)) {
        $size = isset($_wp_additional_image_sizes['post-thumbnail']) ? 'post-thumbnail' : array(266, 266);
        /**
         * Filters the size used to display the post thumbnail image in the 'Featured image' meta box.
         *
         * Note: When a theme adds 'post-thumbnail' support, a special 'post-thumbnail'
         * image size is registered, which differs from the 'thumbnail' image size
         * managed via the Settings > Media screen. See the `$size` parameter description
         * for more information on default values.
         *
         * @since 4.4.0
         *
         * @param string|array $size         Post thumbnail image size to display in the meta box. Accepts any valid
         *                                   image size, or an array of width and height values in pixels (in that order).
         *                                   If the 'post-thumbnail' size is set, default is 'post-thumbnail'. Otherwise,
         *                                   default is an array with 266 as both the height and width values.
         * @param int          $thumbnail_id Post thumbnail attachment ID.
         * @param WP_Post      $post         The post object associated with the thumbnail.
         */
        $size = apply_filters('admin_post_thumbnail_size', $size, $thumbnail_id, $post);
        $thumbnail_html = wp_get_attachment_image($thumbnail_id, $size);
        if (!empty($thumbnail_html)) {
            $content = sprintf($set_thumbnail_link, esc_url($upload_iframe_src), ' aria-describedby="set-post-thumbnail-desc"', $thumbnail_html);
            $content .= '<p class="hide-if-no-js howto" id="set-post-thumbnail-desc">' . __('Click the image to edit or update') . '</p>';
            $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail">' . esc_html($post_type_object->labels->remove_featured_image) . '</a></p>';
        }
    }
    $content .= '<input type="hidden" id="_thumbnail_id" name="_thumbnail_id" value="' . esc_attr($thumbnail_id ? $thumbnail_id : '-1') . '" />';
    /**
     * Filters the admin post thumbnail HTML markup to return.
     *
     * @since 2.9.0
     * @since 3.5.0 Added the `$post_id` parameter.
     * @since 4.6.0 Added the `$thumbnail_id` parameter.
     *
     * @param string   $content      Admin post thumbnail HTML markup.
     * @param int      $post_id      Post ID.
     * @param int|null $thumbnail_id Thumbnail attachment ID, or null if there isn't one.
     */
    return apply_filters('admin_post_thumbnail_html', $content, $post->ID, $thumbnail_id);
}

WordPress Version: 5.4

/**
 * Output HTML for the post thumbnail meta-box.
 *
 * @since 2.9.0
 *
 * @param int $thumbnail_id ID of the attachment used for thumbnail
 * @param int|WP_Post $post Optional. The post ID or object associated with the thumbnail, defaults to global $post.
 * @return string html
 */
function _wp_post_thumbnail_html($thumbnail_id = null, $post = null)
{
    $_wp_additional_image_sizes = wp_get_additional_image_sizes();
    $post = get_post($post);
    $post_type_object = get_post_type_object($post->post_type);
    $set_thumbnail_link = '<p class="hide-if-no-js"><a href="%s" id="set-post-thumbnail"%s class="thickbox">%s</a></p>';
    $upload_iframe_src = get_upload_iframe_src('image', $post->ID);
    $content = sprintf(
        $set_thumbnail_link,
        esc_url($upload_iframe_src),
        '',
        // Empty when there's no featured image set, `aria-describedby` attribute otherwise.
        esc_html($post_type_object->labels->set_featured_image)
    );
    if ($thumbnail_id && get_post($thumbnail_id)) {
        $size = isset($_wp_additional_image_sizes['post-thumbnail']) ? 'post-thumbnail' : array(266, 266);
        /**
         * Filters the size used to display the post thumbnail image in the 'Featured image' meta box.
         *
         * Note: When a theme adds 'post-thumbnail' support, a special 'post-thumbnail'
         * image size is registered, which differs from the 'thumbnail' image size
         * managed via the Settings > Media screen. See the `$size` parameter description
         * for more information on default values.
         *
         * @since 4.4.0
         *
         * @param string|array $size         Post thumbnail image size to display in the meta box. Accepts any valid
         *                                   image size, or an array of width and height values in pixels (in that order).
         *                                   If the 'post-thumbnail' size is set, default is 'post-thumbnail'. Otherwise,
         *                                   default is an array with 266 as both the height and width values.
         * @param int          $thumbnail_id Post thumbnail attachment ID.
         * @param WP_Post      $post         The post object associated with the thumbnail.
         */
        $size = apply_filters('admin_post_thumbnail_size', $size, $thumbnail_id, $post);
        $thumbnail_html = wp_get_attachment_image($thumbnail_id, $size);
        if (!empty($thumbnail_html)) {
            $content = sprintf($set_thumbnail_link, esc_url($upload_iframe_src), ' aria-describedby="set-post-thumbnail-desc"', $thumbnail_html);
            $content .= '<p class="hide-if-no-js howto" id="set-post-thumbnail-desc">' . __('Click the image to edit or update') . '</p>';
            $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail">' . esc_html($post_type_object->labels->remove_featured_image) . '</a></p>';
        }
    }
    $content .= '<input type="hidden" id="_thumbnail_id" name="_thumbnail_id" value="' . esc_attr($thumbnail_id ? $thumbnail_id : '-1') . '" />';
    /**
     * Filters the admin post thumbnail HTML markup to return.
     *
     * @since 2.9.0
     * @since 3.5.0 Added the `$post_id` parameter.
     * @since 4.6.0 Added the `$thumbnail_id` parameter.
     *
     * @param string   $content      Admin post thumbnail HTML markup.
     * @param int      $post_id      Post ID.
     * @param int|null $thumbnail_id Thumbnail attachment ID, or null if there isn't one.
     */
    return apply_filters('admin_post_thumbnail_html', $content, $post->ID, $thumbnail_id);
}

WordPress Version: 5.1

/**
 * Output HTML for the post thumbnail meta-box.
 *
 * @since 2.9.0
 *
 * @param int $thumbnail_id ID of the attachment used for thumbnail
 * @param mixed $post The post ID or object associated with the thumbnail, defaults to global $post.
 * @return string html
 */
function _wp_post_thumbnail_html($thumbnail_id = null, $post = null)
{
    $_wp_additional_image_sizes = wp_get_additional_image_sizes();
    $post = get_post($post);
    $post_type_object = get_post_type_object($post->post_type);
    $set_thumbnail_link = '<p class="hide-if-no-js"><a href="%s" id="set-post-thumbnail"%s class="thickbox">%s</a></p>';
    $upload_iframe_src = get_upload_iframe_src('image', $post->ID);
    $content = sprintf(
        $set_thumbnail_link,
        esc_url($upload_iframe_src),
        '',
        // Empty when there's no featured image set, `aria-describedby` attribute otherwise.
        esc_html($post_type_object->labels->set_featured_image)
    );
    if ($thumbnail_id && get_post($thumbnail_id)) {
        $size = isset($_wp_additional_image_sizes['post-thumbnail']) ? 'post-thumbnail' : array(266, 266);
        /**
         * Filters the size used to display the post thumbnail image in the 'Featured Image' meta box.
         *
         * Note: When a theme adds 'post-thumbnail' support, a special 'post-thumbnail'
         * image size is registered, which differs from the 'thumbnail' image size
         * managed via the Settings > Media screen. See the `$size` parameter description
         * for more information on default values.
         *
         * @since 4.4.0
         *
         * @param string|array $size         Post thumbnail image size to display in the meta box. Accepts any valid
         *                                   image size, or an array of width and height values in pixels (in that order).
         *                                   If the 'post-thumbnail' size is set, default is 'post-thumbnail'. Otherwise,
         *                                   default is an array with 266 as both the height and width values.
         * @param int          $thumbnail_id Post thumbnail attachment ID.
         * @param WP_Post      $post         The post object associated with the thumbnail.
         */
        $size = apply_filters('admin_post_thumbnail_size', $size, $thumbnail_id, $post);
        $thumbnail_html = wp_get_attachment_image($thumbnail_id, $size);
        if (!empty($thumbnail_html)) {
            $content = sprintf($set_thumbnail_link, esc_url($upload_iframe_src), ' aria-describedby="set-post-thumbnail-desc"', $thumbnail_html);
            $content .= '<p class="hide-if-no-js howto" id="set-post-thumbnail-desc">' . __('Click the image to edit or update') . '</p>';
            $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail">' . esc_html($post_type_object->labels->remove_featured_image) . '</a></p>';
        }
    }
    $content .= '<input type="hidden" id="_thumbnail_id" name="_thumbnail_id" value="' . esc_attr($thumbnail_id ? $thumbnail_id : '-1') . '" />';
    /**
     * Filters the admin post thumbnail HTML markup to return.
     *
     * @since 2.9.0
     * @since 3.5.0 Added the `$post_id` parameter.
     * @since 4.6.0 Added the `$thumbnail_id` parameter.
     *
     * @param string   $content      Admin post thumbnail HTML markup.
     * @param int      $post_id      Post ID.
     * @param int|null $thumbnail_id Thumbnail attachment ID, or null if there isn't one.
     */
    return apply_filters('admin_post_thumbnail_html', $content, $post->ID, $thumbnail_id);
}

WordPress Version: 4.7

/**
 * Output HTML for the post thumbnail meta-box.
 *
 * @since 2.9.0
 *
 * @param int $thumbnail_id ID of the attachment used for thumbnail
 * @param mixed $post The post ID or object associated with the thumbnail, defaults to global $post.
 * @return string html
 */
function _wp_post_thumbnail_html($thumbnail_id = null, $post = null)
{
    $_wp_additional_image_sizes = wp_get_additional_image_sizes();
    $post = get_post($post);
    $post_type_object = get_post_type_object($post->post_type);
    $set_thumbnail_link = '<p class="hide-if-no-js"><a href="%s" id="set-post-thumbnail"%s class="thickbox">%s</a></p>';
    $upload_iframe_src = get_upload_iframe_src('image', $post->ID);
    $content = sprintf(
        $set_thumbnail_link,
        esc_url($upload_iframe_src),
        '',
        // Empty when there's no featured image set, `aria-describedby` attribute otherwise.
        esc_html($post_type_object->labels->set_featured_image)
    );
    if ($thumbnail_id && get_post($thumbnail_id)) {
        $size = isset($_wp_additional_image_sizes['post-thumbnail']) ? 'post-thumbnail' : array(266, 266);
        /**
         * Filters the size used to display the post thumbnail image in the 'Featured Image' meta box.
         *
         * Note: When a theme adds 'post-thumbnail' support, a special 'post-thumbnail'
         * image size is registered, which differs from the 'thumbnail' image size
         * managed via the Settings > Media screen. See the `$size` parameter description
         * for more information on default values.
         *
         * @since 4.4.0
         *
         * @param string|array $size         Post thumbnail image size to display in the meta box. Accepts any valid
         *                                   image size, or an array of width and height values in pixels (in that order).
         *                                   If the 'post-thumbnail' size is set, default is 'post-thumbnail'. Otherwise,
         *                                   default is an array with 266 as both the height and width values.
         * @param int          $thumbnail_id Post thumbnail attachment ID.
         * @param WP_Post      $post         The post object associated with the thumbnail.
         */
        $size = apply_filters('admin_post_thumbnail_size', $size, $thumbnail_id, $post);
        $thumbnail_html = wp_get_attachment_image($thumbnail_id, $size);
        if (!empty($thumbnail_html)) {
            $content = sprintf($set_thumbnail_link, esc_url($upload_iframe_src), ' aria-describedby="set-post-thumbnail-desc"', $thumbnail_html);
            $content .= '<p class="hide-if-no-js howto" id="set-post-thumbnail-desc">' . __('Click the image to edit or update') . '</p>';
            $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail">' . esc_html($post_type_object->labels->remove_featured_image) . '</a></p>';
        }
    }
    $content .= '<input type="hidden" id="_thumbnail_id" name="_thumbnail_id" value="' . esc_attr($thumbnail_id ? $thumbnail_id : '-1') . '" />';
    /**
     * Filters the admin post thumbnail HTML markup to return.
     *
     * @since 2.9.0
     * @since 3.5.0 Added the `$post_id` parameter.
     * @since 4.6.0 Added the `$thumbnail_id` parameter.
     *
     * @param string $content      Admin post thumbnail HTML markup.
     * @param int    $post_id      Post ID.
     * @param int    $thumbnail_id Thumbnail ID.
     */
    return apply_filters('admin_post_thumbnail_html', $content, $post->ID, $thumbnail_id);
}

WordPress Version: 4.6

/**
 * Output HTML for the post thumbnail meta-box.
 *
 * @since 2.9.0
 *
 * @global array $_wp_additional_image_sizes
 *
 * @param int $thumbnail_id ID of the attachment used for thumbnail
 * @param mixed $post The post ID or object associated with the thumbnail, defaults to global $post.
 * @return string html
 */
function _wp_post_thumbnail_html($thumbnail_id = null, $post = null)
{
    global $_wp_additional_image_sizes;
    $post = get_post($post);
    $post_type_object = get_post_type_object($post->post_type);
    $set_thumbnail_link = '<p class="hide-if-no-js"><a href="%s" id="set-post-thumbnail"%s class="thickbox">%s</a></p>';
    $upload_iframe_src = get_upload_iframe_src('image', $post->ID);
    $content = sprintf(
        $set_thumbnail_link,
        esc_url($upload_iframe_src),
        '',
        // Empty when there's no featured image set, `aria-describedby` attribute otherwise.
        esc_html($post_type_object->labels->set_featured_image)
    );
    if ($thumbnail_id && get_post($thumbnail_id)) {
        $size = isset($_wp_additional_image_sizes['post-thumbnail']) ? 'post-thumbnail' : array(266, 266);
        /**
         * Filters the size used to display the post thumbnail image in the 'Featured Image' meta box.
         *
         * Note: When a theme adds 'post-thumbnail' support, a special 'post-thumbnail'
         * image size is registered, which differs from the 'thumbnail' image size
         * managed via the Settings > Media screen. See the `$size` parameter description
         * for more information on default values.
         *
         * @since 4.4.0
         *
         * @param string|array $size         Post thumbnail image size to display in the meta box. Accepts any valid
         *                                   image size, or an array of width and height values in pixels (in that order).
         *                                   If the 'post-thumbnail' size is set, default is 'post-thumbnail'. Otherwise,
         *                                   default is an array with 266 as both the height and width values.
         * @param int          $thumbnail_id Post thumbnail attachment ID.
         * @param WP_Post      $post         The post object associated with the thumbnail.
         */
        $size = apply_filters('admin_post_thumbnail_size', $size, $thumbnail_id, $post);
        $thumbnail_html = wp_get_attachment_image($thumbnail_id, $size);
        if (!empty($thumbnail_html)) {
            $content = sprintf($set_thumbnail_link, esc_url($upload_iframe_src), ' aria-describedby="set-post-thumbnail-desc"', $thumbnail_html);
            $content .= '<p class="hide-if-no-js howto" id="set-post-thumbnail-desc">' . __('Click the image to edit or update') . '</p>';
            $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail">' . esc_html($post_type_object->labels->remove_featured_image) . '</a></p>';
        }
    }
    $content .= '<input type="hidden" id="_thumbnail_id" name="_thumbnail_id" value="' . esc_attr($thumbnail_id ? $thumbnail_id : '-1') . '" />';
    /**
     * Filters the admin post thumbnail HTML markup to return.
     *
     * @since 2.9.0
     * @since 3.5.0 Added the `$post_id` parameter.
     * @since 4.6.0 Added the `$thumbnail_id` parameter.
     *
     * @param string $content      Admin post thumbnail HTML markup.
     * @param int    $post_id      Post ID.
     * @param int    $thumbnail_id Thumbnail ID.
     */
    return apply_filters('admin_post_thumbnail_html', $content, $post->ID, $thumbnail_id);
}

WordPress Version: 4.5

/**
 * Output HTML for the post thumbnail meta-box.
 *
 * @since 2.9.0
 *
 * @global int   $content_width
 * @global array $_wp_additional_image_sizes
 *
 * @param int $thumbnail_id ID of the attachment used for thumbnail
 * @param mixed $post The post ID or object associated with the thumbnail, defaults to global $post.
 * @return string html
 */
function _wp_post_thumbnail_html($thumbnail_id = null, $post = null)
{
    global $content_width, $_wp_additional_image_sizes;
    $post = get_post($post);
    $post_type_object = get_post_type_object($post->post_type);
    $set_thumbnail_link = '<p class="hide-if-no-js"><a href="%s" id="set-post-thumbnail"%s class="thickbox">%s</a></p>';
    $upload_iframe_src = get_upload_iframe_src('image', $post->ID);
    $content = sprintf(
        $set_thumbnail_link,
        esc_url($upload_iframe_src),
        '',
        // Empty when there's no featured image set, `aria-describedby` attribute otherwise.
        esc_html($post_type_object->labels->set_featured_image)
    );
    if ($thumbnail_id && get_post($thumbnail_id)) {
        $size = isset($_wp_additional_image_sizes['post-thumbnail']) ? 'post-thumbnail' : array(266, 266);
        /**
         * Filter the size used to display the post thumbnail image in the 'Featured Image' meta box.
         *
         * Note: When a theme adds 'post-thumbnail' support, a special 'post-thumbnail'
         * image size is registered, which differs from the 'thumbnail' image size
         * managed via the Settings > Media screen. See the `$size` parameter description
         * for more information on default values.
         *
         * @since 4.4.0
         *
         * @param string|array $size         Post thumbnail image size to display in the meta box. Accepts any valid
         *                                   image size, or an array of width and height values in pixels (in that order).
         *                                   If the 'post-thumbnail' size is set, default is 'post-thumbnail'. Otherwise,
         *                                   default is an array with 266 as both the height and width values.
         * @param int          $thumbnail_id Post thumbnail attachment ID.
         * @param WP_Post      $post         The post object associated with the thumbnail.
         */
        $size = apply_filters('admin_post_thumbnail_size', $size, $thumbnail_id, $post);
        $thumbnail_html = wp_get_attachment_image($thumbnail_id, $size);
        if (!empty($thumbnail_html)) {
            $ajax_nonce = wp_create_nonce('set_post_thumbnail-' . $post->ID);
            $content = sprintf($set_thumbnail_link, esc_url($upload_iframe_src), ' aria-describedby="set-post-thumbnail-desc"', $thumbnail_html);
            $content .= '<p class="hide-if-no-js howto" id="set-post-thumbnail-desc">' . __('Click the image to edit or update') . '</p>';
            $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html($post_type_object->labels->remove_featured_image) . '</a></p>';
        }
    }
    /**
     * Filter the admin post thumbnail HTML markup to return.
     *
     * @since 2.9.0
     *
     * @param string $content Admin post thumbnail HTML markup.
     * @param int    $post_id Post ID.
     */
    return apply_filters('admin_post_thumbnail_html', $content, $post->ID);
}

WordPress Version: 4.4

/**
 * Output HTML for the post thumbnail meta-box.
 *
 * @since 2.9.0
 *
 * @global int   $content_width
 * @global array $_wp_additional_image_sizes
 *
 * @param int $thumbnail_id ID of the attachment used for thumbnail
 * @param mixed $post The post ID or object associated with the thumbnail, defaults to global $post.
 * @return string html
 */
function _wp_post_thumbnail_html($thumbnail_id = null, $post = null)
{
    global $content_width, $_wp_additional_image_sizes;
    $post = get_post($post);
    $post_type_object = get_post_type_object($post->post_type);
    $set_thumbnail_link = '<p class="hide-if-no-js"><a title="%s" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
    $upload_iframe_src = get_upload_iframe_src('image', $post->ID);
    $content = sprintf($set_thumbnail_link, esc_attr($post_type_object->labels->set_featured_image), esc_url($upload_iframe_src), esc_html($post_type_object->labels->set_featured_image));
    if ($thumbnail_id && get_post($thumbnail_id)) {
        $size = isset($_wp_additional_image_sizes['post-thumbnail']) ? 'post-thumbnail' : array(266, 266);
        /**
         * Filter the size used to display the post thumbnail image in the 'Featured Image' meta box.
         *
         * Note: When a theme adds 'post-thumbnail' support, a special 'post-thumbnail'
         * image size is registered, which differs from the 'thumbnail' image size
         * managed via the Settings > Media screen. See the `$size` parameter description
         * for more information on default values.
         *
         * @since 4.4.0
         *
         * @param string|array $size         Post thumbnail image size to display in the meta box. Accepts any valid
         *                                   image size, or an array of width and height values in pixels (in that order).
         *                                   If the 'post-thumbnail' size is set, default is 'post-thumbnail'. Otherwise,
         *                                   default is an array with 266 as both the height and width values.
         * @param int          $thumbnail_id Post thumbnail attachment ID.
         * @param WP_Post      $post         The post object associated with the thumbnail.
         */
        $size = apply_filters('admin_post_thumbnail_size', $size, $thumbnail_id, $post);
        $thumbnail_html = wp_get_attachment_image($thumbnail_id, $size);
        if (!empty($thumbnail_html)) {
            $ajax_nonce = wp_create_nonce('set_post_thumbnail-' . $post->ID);
            $content = sprintf($set_thumbnail_link, esc_attr($post_type_object->labels->set_featured_image), esc_url($upload_iframe_src), $thumbnail_html);
            $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html($post_type_object->labels->remove_featured_image) . '</a></p>';
        }
    }
    /**
     * Filter the admin post thumbnail HTML markup to return.
     *
     * @since 2.9.0
     *
     * @param string $content Admin post thumbnail HTML markup.
     * @param int    $post_id Post ID.
     */
    return apply_filters('admin_post_thumbnail_html', $content, $post->ID);
}

WordPress Version: 4.3

/**
 * Output HTML for the post thumbnail meta-box.
 *
 * @since 2.9.0
 *
 * @global int   $content_width
 * @global array $_wp_additional_image_sizes
 *
 * @param int $thumbnail_id ID of the attachment used for thumbnail
 * @param mixed $post The post ID or object associated with the thumbnail, defaults to global $post.
 * @return string html
 */
function _wp_post_thumbnail_html($thumbnail_id = null, $post = null)
{
    global $content_width, $_wp_additional_image_sizes;
    $post = get_post($post);
    $post_type_object = get_post_type_object($post->post_type);
    $set_thumbnail_link = '<p class="hide-if-no-js"><a title="%s" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
    $upload_iframe_src = get_upload_iframe_src('image', $post->ID);
    $content = sprintf($set_thumbnail_link, esc_attr($post_type_object->labels->set_featured_image), esc_url($upload_iframe_src), esc_html($post_type_object->labels->set_featured_image));
    if ($thumbnail_id && get_post($thumbnail_id)) {
        $old_content_width = $content_width;
        $content_width = 266;
        if (!isset($_wp_additional_image_sizes['post-thumbnail'])) {
            $thumbnail_html = wp_get_attachment_image($thumbnail_id, array($content_width, $content_width));
        } else {
            $thumbnail_html = wp_get_attachment_image($thumbnail_id, 'post-thumbnail');
        }
        if (!empty($thumbnail_html)) {
            $ajax_nonce = wp_create_nonce('set_post_thumbnail-' . $post->ID);
            $content = sprintf($set_thumbnail_link, esc_attr($post_type_object->labels->set_featured_image), esc_url($upload_iframe_src), $thumbnail_html);
            $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html($post_type_object->labels->remove_featured_image) . '</a></p>';
        }
        $content_width = $old_content_width;
    }
    /**
     * Filter the admin post thumbnail HTML markup to return.
     *
     * @since 2.9.0
     *
     * @param string $content Admin post thumbnail HTML markup.
     * @param int    $post_id Post ID.
     */
    return apply_filters('admin_post_thumbnail_html', $content, $post->ID);
}

WordPress Version: 3.9

/**
 * Output HTML for the post thumbnail meta-box.
 *
 * @since 2.9.0
 *
 * @param int $thumbnail_id ID of the attachment used for thumbnail
 * @param mixed $post The post ID or object associated with the thumbnail, defaults to global $post.
 * @return string html
 */
function _wp_post_thumbnail_html($thumbnail_id = null, $post = null)
{
    global $content_width, $_wp_additional_image_sizes;
    $post = get_post($post);
    $upload_iframe_src = esc_url(get_upload_iframe_src('image', $post->ID));
    $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__('Set featured image') . '" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
    $content = sprintf($set_thumbnail_link, $upload_iframe_src, esc_html__('Set featured image'));
    if ($thumbnail_id && get_post($thumbnail_id)) {
        $old_content_width = $content_width;
        $content_width = 266;
        if (!isset($_wp_additional_image_sizes['post-thumbnail'])) {
            $thumbnail_html = wp_get_attachment_image($thumbnail_id, array($content_width, $content_width));
        } else {
            $thumbnail_html = wp_get_attachment_image($thumbnail_id, 'post-thumbnail');
        }
        if (!empty($thumbnail_html)) {
            $ajax_nonce = wp_create_nonce('set_post_thumbnail-' . $post->ID);
            $content = sprintf($set_thumbnail_link, $upload_iframe_src, $thumbnail_html);
            $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__('Remove featured image') . '</a></p>';
        }
        $content_width = $old_content_width;
    }
    /**
     * Filter the admin post thumbnail HTML markup to return.
     *
     * @since 2.9.0
     *
     * @param string $content Admin post thumbnail HTML markup.
     * @param int    $post_id Post ID.
     */
    return apply_filters('admin_post_thumbnail_html', $content, $post->ID);
}

WordPress Version: 3.7

/**
 * Output HTML for the post thumbnail meta-box.
 *
 * @since 2.9.0
 *
 * @param int $thumbnail_id ID of the attachment used for thumbnail
 * @param mixed $post The post ID or object associated with the thumbnail, defaults to global $post.
 * @return string html
 */
function _wp_post_thumbnail_html($thumbnail_id = null, $post = null)
{
    global $content_width, $_wp_additional_image_sizes;
    $post = get_post($post);
    $upload_iframe_src = esc_url(get_upload_iframe_src('image', $post->ID));
    $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__('Set featured image') . '" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
    $content = sprintf($set_thumbnail_link, $upload_iframe_src, esc_html__('Set featured image'));
    if ($thumbnail_id && get_post($thumbnail_id)) {
        $old_content_width = $content_width;
        $content_width = 266;
        if (!isset($_wp_additional_image_sizes['post-thumbnail'])) {
            $thumbnail_html = wp_get_attachment_image($thumbnail_id, array($content_width, $content_width));
        } else {
            $thumbnail_html = wp_get_attachment_image($thumbnail_id, 'post-thumbnail');
        }
        if (!empty($thumbnail_html)) {
            $ajax_nonce = wp_create_nonce('set_post_thumbnail-' . $post->ID);
            $content = sprintf($set_thumbnail_link, $upload_iframe_src, $thumbnail_html);
            $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__('Remove featured image') . '</a></p>';
        }
        $content_width = $old_content_width;
    }
    return apply_filters('admin_post_thumbnail_html', $content, $post->ID);
}