get_theme_update_available

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

WordPress Version: 6.1

/**
 * Retrieves the update link if there is a theme update available.
 *
 * Will return a link if there is an update available.
 *
 * @since 3.8.0
 *
 * @param WP_Theme $theme WP_Theme object.
 * @return string|false HTML for the update link, or false if invalid info was passed.
 */
function get_theme_update_available($theme)
{
    static $themes_update = null;
    if (!current_user_can('update_themes')) {
        return false;
    }
    if (!isset($themes_update)) {
        $themes_update = get_site_transient('update_themes');
    }
    if (!$theme instanceof WP_Theme) {
        return false;
    }
    $stylesheet = $theme->get_stylesheet();
    $html = '';
    if (isset($themes_update->response[$stylesheet])) {
        $update = $themes_update->response[$stylesheet];
        $theme_name = $theme->display('Name');
        $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']);
        // Theme browser inside WP? Replace this. Also, theme preview JS will override this on the available list.
        $update_url = wp_nonce_url(admin_url('update.php?action=upgrade-theme&theme=' . urlencode($stylesheet)), 'upgrade-theme_' . $stylesheet);
        if (!is_multisite()) {
            if (!current_user_can('update_themes')) {
                $html = sprintf(
                    /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number. */
                    '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.') . '</strong></p>',
                    $theme_name,
                    esc_url($details_url),
                    sprintf(
                        'class="thickbox open-plugin-details-modal" aria-label="%s"',
                        /* translators: 1: Theme name, 2: Version number. */
                        esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))
                    ),
                    $update['new_version']
                );
            } elseif (empty($update['package'])) {
                $html = sprintf(
                    /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number. */
                    '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>') . '</strong></p>',
                    $theme_name,
                    esc_url($details_url),
                    sprintf(
                        'class="thickbox open-plugin-details-modal" aria-label="%s"',
                        /* translators: 1: Theme name, 2: Version number. */
                        esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))
                    ),
                    $update['new_version']
                );
            } else {
                $html = sprintf(
                    /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number, 5: Update URL, 6: Additional link attributes. */
                    '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.') . '</strong></p>',
                    $theme_name,
                    esc_url($details_url),
                    sprintf(
                        'class="thickbox open-plugin-details-modal" aria-label="%s"',
                        /* translators: 1: Theme name, 2: Version number. */
                        esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))
                    ),
                    $update['new_version'],
                    $update_url,
                    sprintf(
                        'aria-label="%s" id="update-theme" data-slug="%s"',
                        /* translators: %s: Theme name. */
                        esc_attr(sprintf(_x('Update %s now', 'theme'), $theme_name)),
                        $stylesheet
                    )
                );
            }
        }
    }
    return $html;
}

WordPress Version: 5.5

/**
 * Retrieve the update link if there is a theme update available.
 *
 * Will return a link if there is an update available.
 *
 * @since 3.8.0
 *
 * @param WP_Theme $theme WP_Theme object.
 * @return string|false HTML for the update link, or false if invalid info was passed.
 */
function get_theme_update_available($theme)
{
    static $themes_update = null;
    if (!current_user_can('update_themes')) {
        return false;
    }
    if (!isset($themes_update)) {
        $themes_update = get_site_transient('update_themes');
    }
    if (!$theme instanceof WP_Theme) {
        return false;
    }
    $stylesheet = $theme->get_stylesheet();
    $html = '';
    if (isset($themes_update->response[$stylesheet])) {
        $update = $themes_update->response[$stylesheet];
        $theme_name = $theme->display('Name');
        $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']);
        // Theme browser inside WP? Replace this. Also, theme preview JS will override this on the available list.
        $update_url = wp_nonce_url(admin_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet)), 'upgrade-theme_' . $stylesheet);
        if (!is_multisite()) {
            if (!current_user_can('update_themes')) {
                $html = sprintf(
                    /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number. */
                    '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.') . '</strong></p>',
                    $theme_name,
                    esc_url($details_url),
                    sprintf(
                        'class="thickbox open-plugin-details-modal" aria-label="%s"',
                        /* translators: 1: Theme name, 2: Version number. */
                        esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))
                    ),
                    $update['new_version']
                );
            } elseif (empty($update['package'])) {
                $html = sprintf(
                    /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number. */
                    '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>') . '</strong></p>',
                    $theme_name,
                    esc_url($details_url),
                    sprintf(
                        'class="thickbox open-plugin-details-modal" aria-label="%s"',
                        /* translators: 1: Theme name, 2: Version number. */
                        esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))
                    ),
                    $update['new_version']
                );
            } else {
                $html = sprintf(
                    /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number, 5: Update URL, 6: Additional link attributes. */
                    '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.') . '</strong></p>',
                    $theme_name,
                    esc_url($details_url),
                    sprintf(
                        'class="thickbox open-plugin-details-modal" aria-label="%s"',
                        /* translators: 1: Theme name, 2: Version number. */
                        esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))
                    ),
                    $update['new_version'],
                    $update_url,
                    sprintf(
                        'aria-label="%s" id="update-theme" data-slug="%s"',
                        /* translators: %s: Theme name. */
                        esc_attr(sprintf(_x('Update %s now', 'theme'), $theme_name)),
                        $stylesheet
                    )
                );
            }
        }
    }
    return $html;
}

WordPress Version: 5.4

/**
 * Retrieve the update link if there is a theme update available.
 *
 * Will return a link if there is an update available.
 *
 * @since 3.8.0
 *
 * @staticvar object $themes_update
 *
 * @param WP_Theme $theme WP_Theme object.
 * @return string|false HTML for the update link, or false if invalid info was passed.
 */
function get_theme_update_available($theme)
{
    static $themes_update = null;
    if (!current_user_can('update_themes')) {
        return false;
    }
    if (!isset($themes_update)) {
        $themes_update = get_site_transient('update_themes');
    }
    if (!$theme instanceof WP_Theme) {
        return false;
    }
    $stylesheet = $theme->get_stylesheet();
    $html = '';
    if (isset($themes_update->response[$stylesheet])) {
        $update = $themes_update->response[$stylesheet];
        $theme_name = $theme->display('Name');
        $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']);
        // Theme browser inside WP? Replace this. Also, theme preview JS will override this on the available list.
        $update_url = wp_nonce_url(admin_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet)), 'upgrade-theme_' . $stylesheet);
        if (!is_multisite()) {
            if (!current_user_can('update_themes')) {
                $html = sprintf(
                    /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number. */
                    '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.') . '</strong></p>',
                    $theme_name,
                    esc_url($details_url),
                    sprintf(
                        'class="thickbox open-plugin-details-modal" aria-label="%s"',
                        /* translators: 1: Theme name, 2: Version number. */
                        esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))
                    ),
                    $update['new_version']
                );
            } elseif (empty($update['package'])) {
                $html = sprintf(
                    /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number. */
                    '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>') . '</strong></p>',
                    $theme_name,
                    esc_url($details_url),
                    sprintf(
                        'class="thickbox open-plugin-details-modal" aria-label="%s"',
                        /* translators: 1: Theme name, 2: Version number. */
                        esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))
                    ),
                    $update['new_version']
                );
            } else {
                $html = sprintf(
                    /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number, 5: Update URL, 6: Additional link attributes. */
                    '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.') . '</strong></p>',
                    $theme_name,
                    esc_url($details_url),
                    sprintf(
                        'class="thickbox open-plugin-details-modal" aria-label="%s"',
                        /* translators: 1: Theme name, 2: Version number. */
                        esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))
                    ),
                    $update['new_version'],
                    $update_url,
                    sprintf(
                        'aria-label="%s" id="update-theme" data-slug="%s"',
                        /* translators: %s: Theme name. */
                        esc_attr(sprintf(__('Update %s now'), $theme_name)),
                        $stylesheet
                    )
                );
            }
        }
    }
    return $html;
}

WordPress Version: 5.3

/**
 * Retrieve the update link if there is a theme update available.
 *
 * Will return a link if there is an update available.
 *
 * @since 3.8.0
 *
 * @staticvar object $themes_update
 *
 * @param WP_Theme $theme WP_Theme object.
 * @return false|string HTML for the update link, or false if invalid info was passed.
 */
function get_theme_update_available($theme)
{
    static $themes_update = null;
    if (!current_user_can('update_themes')) {
        return false;
    }
    if (!isset($themes_update)) {
        $themes_update = get_site_transient('update_themes');
    }
    if (!$theme instanceof WP_Theme) {
        return false;
    }
    $stylesheet = $theme->get_stylesheet();
    $html = '';
    if (isset($themes_update->response[$stylesheet])) {
        $update = $themes_update->response[$stylesheet];
        $theme_name = $theme->display('Name');
        $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']);
        //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
        $update_url = wp_nonce_url(admin_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet)), 'upgrade-theme_' . $stylesheet);
        if (!is_multisite()) {
            if (!current_user_can('update_themes')) {
                $html = sprintf(
                    /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number. */
                    '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.') . '</strong></p>',
                    $theme_name,
                    esc_url($details_url),
                    sprintf(
                        'class="thickbox open-plugin-details-modal" aria-label="%s"',
                        /* translators: 1: Theme name, 2: Version number. */
                        esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))
                    ),
                    $update['new_version']
                );
            } elseif (empty($update['package'])) {
                $html = sprintf(
                    /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number. */
                    '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>') . '</strong></p>',
                    $theme_name,
                    esc_url($details_url),
                    sprintf(
                        'class="thickbox open-plugin-details-modal" aria-label="%s"',
                        /* translators: 1: Theme name, 2: Version number. */
                        esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))
                    ),
                    $update['new_version']
                );
            } else {
                $html = sprintf(
                    /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number, 5: Update URL, 6: Additional link attributes. */
                    '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.') . '</strong></p>',
                    $theme_name,
                    esc_url($details_url),
                    sprintf(
                        'class="thickbox open-plugin-details-modal" aria-label="%s"',
                        /* translators: 1: Theme name, 2: Version number. */
                        esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))
                    ),
                    $update['new_version'],
                    $update_url,
                    sprintf(
                        'aria-label="%s" id="update-theme" data-slug="%s"',
                        /* translators: %s: Theme name. */
                        esc_attr(sprintf(__('Update %s now'), $theme_name)),
                        $stylesheet
                    )
                );
            }
        }
    }
    return $html;
}

WordPress Version: 4.6

/**
 * Retrieve the update link if there is a theme update available.
 *
 * Will return a link if there is an update available.
 *
 * @since 3.8.0
 *
 * @staticvar object $themes_update
 *
 * @param WP_Theme $theme WP_Theme object.
 * @return false|string HTML for the update link, or false if invalid info was passed.
 */
function get_theme_update_available($theme)
{
    static $themes_update = null;
    if (!current_user_can('update_themes')) {
        return false;
    }
    if (!isset($themes_update)) {
        $themes_update = get_site_transient('update_themes');
    }
    if (!$theme instanceof WP_Theme) {
        return false;
    }
    $stylesheet = $theme->get_stylesheet();
    $html = '';
    if (isset($themes_update->response[$stylesheet])) {
        $update = $themes_update->response[$stylesheet];
        $theme_name = $theme->display('Name');
        $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']);
        //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
        $update_url = wp_nonce_url(admin_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet)), 'upgrade-theme_' . $stylesheet);
        if (!is_multisite()) {
            if (!current_user_can('update_themes')) {
                /* translators: 1: theme name, 2: theme details URL, 3: additional link attributes, 4: version number */
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.') . '</strong></p>', $theme_name, esc_url($details_url), sprintf(
                    'class="thickbox open-plugin-details-modal" aria-label="%s"',
                    /* translators: 1: theme name, 2: version number */
                    esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))
                ), $update['new_version']);
            } elseif (empty($update['package'])) {
                /* translators: 1: theme name, 2: theme details URL, 3: additional link attributes, 4: version number */
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>') . '</strong></p>', $theme_name, esc_url($details_url), sprintf(
                    'class="thickbox open-plugin-details-modal" aria-label="%s"',
                    /* translators: 1: theme name, 2: version number */
                    esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))
                ), $update['new_version']);
            } else {
                /* translators: 1: theme name, 2: theme details URL, 3: additional link attributes, 4: version number, 5: update URL, 6: additional link attributes */
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.') . '</strong></p>', $theme_name, esc_url($details_url), sprintf(
                    'class="thickbox open-plugin-details-modal" aria-label="%s"',
                    /* translators: 1: theme name, 2: version number */
                    esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))
                ), $update['new_version'], $update_url, sprintf(
                    'aria-label="%s" id="update-theme" data-slug="%s"',
                    /* translators: %s: theme name */
                    esc_attr(sprintf(__('Update %s now'), $theme_name)),
                    $stylesheet
                ));
            }
        }
    }
    return $html;
}

WordPress Version: 4.5

/**
 * Retrieve the update link if there is a theme update available.
 *
 * Will return a link if there is an update available.
 *
 * @since 3.8.0
 *
 * @staticvar object $themes_update
 *
 * @param WP_Theme $theme WP_Theme object.
 * @return false|string HTML for the update link, or false if invalid info was passed.
 */
function get_theme_update_available($theme)
{
    static $themes_update = null;
    if (!current_user_can('update_themes')) {
        return false;
    }
    if (!isset($themes_update)) {
        $themes_update = get_site_transient('update_themes');
    }
    if (!$theme instanceof WP_Theme) {
        return false;
    }
    $stylesheet = $theme->get_stylesheet();
    $html = '';
    if (isset($themes_update->response[$stylesheet])) {
        $update = $themes_update->response[$stylesheet];
        $theme_name = $theme->display('Name');
        $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']);
        //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
        $update_url = wp_nonce_url(admin_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet)), 'upgrade-theme_' . $stylesheet);
        if (!is_multisite()) {
            if (!current_user_can('update_themes')) {
                /* translators: 1: theme name, 2: theme details URL, 3: accessibility text, 4: version number */
                $html = sprintf(
                    '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" aria-label="%3$s">View version %4$s details</a>.') . '</strong></p>',
                    $theme_name,
                    esc_url($details_url),
                    /* translators: 1: theme name, 2: version number */
                    esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version'])),
                    $update['new_version']
                );
            } elseif (empty($update['package'])) {
                /* translators: 1: theme name, 2: theme details URL, 3: accessibility text, 4: version number */
                $html = sprintf(
                    '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" aria-label="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>') . '</strong></p>',
                    $theme_name,
                    esc_url($details_url),
                    /* translators: 1: theme name, 2: version number */
                    esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version'])),
                    $update['new_version']
                );
            } else {
                /* translators: 1: theme name, 2: theme details URL, 3: accessibility text, 4: version number, 5: update URL, 6: accessibility text */
                $html = sprintf(
                    '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" aria-label="%3$s">View version %4$s details</a> or <a href="%5$s" aria-label="%6$s">update now</a>.') . '</strong></p>',
                    $theme_name,
                    esc_url($details_url),
                    /* translators: 1: theme name, 2: version number */
                    esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version'])),
                    $update['new_version'],
                    $update_url,
                    /* translators: %s: theme name */
                    esc_attr(sprintf(__('Update %s now'), $theme_name))
                );
            }
        }
    }
    return $html;
}

WordPress Version: 4.3

/**
 * Retrieve the update link if there is a theme update available.
 *
 * Will return a link if there is an update available.
 *
 * @since 3.8.0
 *
 * @staticvar object $themes_update
 *
 * @param WP_Theme $theme WP_Theme object.
 * @return false|string HTML for the update link, or false if invalid info was passed.
 */
function get_theme_update_available($theme)
{
    static $themes_update = null;
    if (!current_user_can('update_themes')) {
        return false;
    }
    if (!isset($themes_update)) {
        $themes_update = get_site_transient('update_themes');
    }
    if (!$theme instanceof WP_Theme) {
        return false;
    }
    $stylesheet = $theme->get_stylesheet();
    $html = '';
    if (isset($themes_update->response[$stylesheet])) {
        $update = $themes_update->response[$stylesheet];
        $theme_name = $theme->display('Name');
        $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']);
        //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
        $update_url = wp_nonce_url(admin_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet)), 'upgrade-theme_' . $stylesheet);
        $update_onclick = 'onclick="if ( confirm(\'' . esc_js(__("Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update.")) . '\') ) {return true;}return false;"';
        if (!is_multisite()) {
            if (!current_user_can('update_themes')) {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.') . '</strong></p>', $theme_name, esc_url($details_url), esc_attr($theme['Name']), $update['new_version']);
            } elseif (empty($update['package'])) {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>') . '</strong></p>', $theme_name, esc_url($details_url), esc_attr($theme['Name']), $update['new_version']);
            } else {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.') . '</strong></p>', $theme_name, esc_url($details_url), esc_attr($theme['Name']), $update['new_version'], $update_url, $update_onclick);
            }
        }
    }
    return $html;
}

WordPress Version: 4.2

/**
 * Retrieve the update link if there is a theme update available.
 *
 * Will return a link if there is an update available.
 *
 * @since 3.8.0
 *
 * @param WP_Theme $theme WP_Theme object.
 * @return false|string HTML for the update link, or false if invalid info was passed.
 */
function get_theme_update_available($theme)
{
    static $themes_update;
    if (!current_user_can('update_themes')) {
        return false;
    }
    if (!isset($themes_update)) {
        $themes_update = get_site_transient('update_themes');
    }
    if (!$theme instanceof WP_Theme) {
        return false;
    }
    $stylesheet = $theme->get_stylesheet();
    $html = '';
    if (isset($themes_update->response[$stylesheet])) {
        $update = $themes_update->response[$stylesheet];
        $theme_name = $theme->display('Name');
        $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']);
        //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
        $update_url = wp_nonce_url(admin_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet)), 'upgrade-theme_' . $stylesheet);
        $update_onclick = 'onclick="if ( confirm(\'' . esc_js(__("Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update.")) . '\') ) {return true;}return false;"';
        if (!is_multisite()) {
            if (!current_user_can('update_themes')) {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.') . '</strong></p>', $theme_name, esc_url($details_url), esc_attr($theme['Name']), $update['new_version']);
            } elseif (empty($update['package'])) {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>') . '</strong></p>', $theme_name, esc_url($details_url), esc_attr($theme['Name']), $update['new_version']);
            } else {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.') . '</strong></p>', $theme_name, esc_url($details_url), esc_attr($theme['Name']), $update['new_version'], $update_url, $update_onclick);
            }
        }
    }
    return $html;
}

WordPress Version: 4.1

/**
 * Retrieve the update link if there is a theme update available.
 *
 * Will return a link if there is an update available.
 *
 * @since 3.8.0
 *
 * @param WP_Theme $theme WP_Theme object.
 * @return false|string HTML for the update link, or false if invalid info was passed.
 */
function get_theme_update_available($theme)
{
    static $themes_update;
    if (!current_user_can('update_themes')) {
        return false;
    }
    if (!isset($themes_update)) {
        $themes_update = get_site_transient('update_themes');
    }
    if (!is_a($theme, 'WP_Theme')) {
        return false;
    }
    $stylesheet = $theme->get_stylesheet();
    $html = '';
    if (isset($themes_update->response[$stylesheet])) {
        $update = $themes_update->response[$stylesheet];
        $theme_name = $theme->display('Name');
        $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']);
        //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
        $update_url = wp_nonce_url(admin_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet)), 'upgrade-theme_' . $stylesheet);
        $update_onclick = 'onclick="if ( confirm(\'' . esc_js(__("Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update.")) . '\') ) {return true;}return false;"';
        if (!is_multisite()) {
            if (!current_user_can('update_themes')) {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.') . '</strong></p>', $theme_name, esc_url($details_url), esc_attr($theme['Name']), $update['new_version']);
            } else if (empty($update['package'])) {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>') . '</strong></p>', $theme_name, esc_url($details_url), esc_attr($theme['Name']), $update['new_version']);
            } else {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.') . '</strong></p>', $theme_name, esc_url($details_url), esc_attr($theme['Name']), $update['new_version'], $update_url, $update_onclick);
            }
        }
    }
    return $html;
}

WordPress Version: 3.9

/**
 * Retrieve the update link if there is a theme update available.
 *
 * Will return a link if there is an update available.
 *
 * @since 3.8.0
 *
 * @param WP_Theme $theme WP_Theme object.
 * @return string|bool HTML for the update link, or false if invalid info was passed.
 */
function get_theme_update_available($theme)
{
    static $themes_update;
    if (!current_user_can('update_themes')) {
        return false;
    }
    if (!isset($themes_update)) {
        $themes_update = get_site_transient('update_themes');
    }
    if (!is_a($theme, 'WP_Theme')) {
        return false;
    }
    $stylesheet = $theme->get_stylesheet();
    $html = '';
    if (isset($themes_update->response[$stylesheet])) {
        $update = $themes_update->response[$stylesheet];
        $theme_name = $theme->display('Name');
        $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']);
        //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
        $update_url = wp_nonce_url(admin_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet)), 'upgrade-theme_' . $stylesheet);
        $update_onclick = 'onclick="if ( confirm(\'' . esc_js(__("Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update.")) . '\') ) {return true;}return false;"';
        if (!is_multisite()) {
            if (!current_user_can('update_themes')) {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.') . '</strong></p>', $theme_name, esc_url($details_url), esc_attr($theme['Name']), $update['new_version']);
            } else if (empty($update['package'])) {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>') . '</strong></p>', $theme_name, esc_url($details_url), esc_attr($theme['Name']), $update['new_version']);
            } else {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.') . '</strong></p>', $theme_name, esc_url($details_url), esc_attr($theme['Name']), $update['new_version'], $update_url, $update_onclick);
            }
        }
    }
    return $html;
}

WordPress Version: 3.8

/**
 * Retrieve the update link if there is a theme update available.
 *
 * Will return a link if there is an update available.
 *
 * @since 3.8.0
 *
 * @param WP_Theme $theme WP_Theme object.
 * @return string|bool HTML for the update link, or false if invalid info was passed.
 */
function get_theme_update_available($theme)
{
    static $themes_update;
    if (!current_user_can('update_themes')) {
        return false;
    }
    if (!isset($themes_update)) {
        $themes_update = get_site_transient('update_themes');
    }
    if (!is_a($theme, 'WP_Theme')) {
        return false;
    }
    $stylesheet = $theme->get_stylesheet();
    $html = '';
    if (isset($themes_update->response[$stylesheet])) {
        $update = $themes_update->response[$stylesheet];
        $theme_name = $theme->display('Name');
        $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']);
        //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
        $update_url = wp_nonce_url(admin_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet)), 'upgrade-theme_' . $stylesheet);
        $update_onclick = 'onclick="if ( confirm(\'' . esc_js(__("Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update.")) . '\') ) {return true;}return false;"';
        if (!is_multisite()) {
            if (!current_user_can('update_themes')) {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s details</a>.') . '</strong></p>', $theme_name, $details_url, $update['new_version']);
            } else if (empty($update['package'])) {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s details</a>. <em>Automatic update is unavailable for this theme.</em>') . '</strong></p>', $theme_name, $details_url, $update['new_version']);
            } else {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s details</a> or <a href="%4$s" %5$s>update now</a>.') . '</strong></p>', $theme_name, $details_url, $update['new_version'], $update_url, $update_onclick);
            }
        }
    }
    return $html;
}