Title: get_theme_update_available
Published: April 25, 2014
Last modified: February 24, 2026

---

# get_theme_update_available( WP_Theme $theme ): string|false

## In this article

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

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

Retrieves the update link if there is a theme update available.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/get_theme_update_available/?output_format=md#description)󠁿

Will return a link if there is an update available.

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

 `$theme`[WP_Theme](https://developer.wordpress.org/reference/classes/wp_theme/)
required

[WP_Theme](https://developer.wordpress.org/reference/classes/wp_theme/) object.

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

 string|false HTML for the update link, or false if invalid info was passed.

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

    ```php
    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;
    }
    ```

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

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

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

Returns whether the current user has the specified capability.

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

Retrieves the translation of $text.

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

Retrieves translated string with gettext context.

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

Checks and cleans a URL.

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

Escaping for HTML attributes.

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

Determines whether Multisite is enabled.

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

Retrieves URL with nonce added to URL query.

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

Retrieves a modified URL query string.

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

Retrieves the URL to the admin area for the current site.

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

Retrieves the value of a site transient.

  |

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

| Used by | Description | 
| [wp_prepare_themes_for_js()](https://developer.wordpress.org/reference/functions/wp_prepare_themes_for_js/)`wp-admin/includes/theme.php` |

Prepares themes for JavaScript.

  | 
| [theme_update_available()](https://developer.wordpress.org/reference/functions/theme_update_available/)`wp-admin/includes/theme.php` |

Check if there is an update for a theme available.

  |

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

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

## User Contributed Notes

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