: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
/* translators: %s: URL to WordPress Updates screen. */
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
self_admin_url( 'update-core.php' )
} elseif ( current_user_can( 'update_php' ) ) {
/* translators: %s: URL to Update PHP page. */
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
esc_url( wp_get_update_php_url() )
wp_update_php_annotation( '</p><p><em>', '</em>' );
<# } else if ( ! data.compatibleWP ) { #>
_e( 'This theme does not work with your version of WordPress.' );
if ( current_user_can( 'update_core' ) ) {
/* translators: %s: URL to WordPress Updates screen. */
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
self_admin_url( 'update-core.php' )
<# } else if ( ! data.compatiblePHP ) { #>
_e( 'This theme does not work with your version of PHP.' );
if ( current_user_can( 'update_php' ) ) {
/* translators: %s: URL to Update PHP page. */
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
esc_url( wp_get_update_php_url() )
wp_update_php_annotation( '</p><p><em>', '</em>' );
<# } else if ( ! data.active && data.blockTheme ) { #>
<div class="notice notice-error notice-alt notice-large"><p>
_e( 'This theme doesn\'t support Customizer.' );
<# if ( data.actions.activate ) { #>
/* translators: %s: URL to the themes page (also it activates the theme). */
' ' . __( 'However, you can still <a href="%s">activate this theme</a>, and use the Site Editor to customize it.' ),
'{{{ data.actions.activate }}}'
<p class="theme-description">{{{ data.description }}}</p>
<p class="theme-tags"><span><?php _e( 'Tags:' ); ?></span> {{{ data.tags }}}</p>
<div class="theme-actions">
<# if ( data.active ) { #>
<button type="button" class="button button-primary customize-theme"><?php _e( 'Customize' ); ?></button>
<# } else if ( 'installed' === data.type ) { #>
<div class="theme-inactive-actions">
<# if ( data.blockTheme ) { #>
/* translators: %s: Theme name. */
$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
<# if ( data.compatibleWP && data.compatiblePHP && data.actions.activate ) { #>
<a href="{{{ data.actions.activate }}}" class="button button-primary activate" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
<# if ( data.compatibleWP && data.compatiblePHP ) { #>
<button type="button" class="button button-primary preview-theme" data-slug="{{ data.id }}"><?php _e( 'Live Preview' ); ?></button>
<button class="button button-primary disabled"><?php _e( 'Live Preview' ); ?></button>
<?php if ( current_user_can( 'delete_themes' ) ) { ?>
<# if ( data.actions && data.actions['delete'] ) { #>
<a href="{{{ data.actions['delete'] }}}" data-slug="{{ data.id }}" class="button button-secondary delete-theme"><?php _e( 'Delete' ); ?></a>
<# if ( data.compatibleWP && data.compatiblePHP ) { #>
<button type="button" class="button theme-install" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></button>
<button type="button" class="button button-primary theme-install preview" data-slug="{{ data.id }}"><?php _e( 'Install & Preview' ); ?></button>
<button type="button" class="button disabled"><?php _ex( 'Cannot Install', 'theme' ); ?></button>
<button type="button" class="button button-primary disabled"><?php _e( 'Install & Preview' ); ?></button>
* Determines whether a theme is technically active but was paused while
* For more information on this and similar theme functions, check out
* the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
* Conditional Tags} article in the Theme Developer Handbook.
* @global WP_Paused_Extensions_Storage $_paused_themes
* @param string $theme Path to the theme directory relative to the themes directory.
* @return bool True, if in the list of paused themes. False, not in the list.
function is_theme_paused( $theme ) {
if ( ! isset( $GLOBALS['_paused_themes'] ) ) {
if ( get_stylesheet() !== $theme && get_template() !== $theme ) {
return array_key_exists( $theme, $GLOBALS['_paused_themes'] );
* Gets the error that was recorded for a paused theme.
* @global WP_Paused_Extensions_Storage $_paused_themes
* @param string $theme Path to the theme directory relative to the themes
* @return array|false Array of error information as it was returned by
* `error_get_last()`, or false if none was recorded.
function wp_get_theme_error( $theme ) {
if ( ! isset( $GLOBALS['_paused_themes'] ) ) {
if ( ! array_key_exists( $theme, $GLOBALS['_paused_themes'] ) ) {
return $GLOBALS['_paused_themes'][ $theme ];
* Tries to resume a single theme.
* If a redirect was provided and a functions.php file was found, we first ensure that
* functions.php file does not throw fatal errors anymore.
* The way it works is by setting the redirection to the error before trying to
* include the file. If the theme fails, then the redirection will not be overwritten
* with the success message and the theme will not be resumed.
* @global string $wp_stylesheet_path Path to current theme's stylesheet directory.
* @global string $wp_template_path Path to current theme's template directory.
* @param string $theme Single theme to resume.
* @param string $redirect Optional. URL to redirect to. Default empty string.
* @return bool|WP_Error True on success, false if `$theme` was not paused,
function resume_theme( $theme, $redirect = '' ) {
global $wp_stylesheet_path, $wp_template_path;
list( $extension ) = explode( '/', $theme );
* We'll override this later if the theme could be resumed without
* creating a fatal error.
if ( ! empty( $redirect ) ) {
if ( str_contains( $wp_stylesheet_path, $extension ) ) {
$functions_path = $wp_stylesheet_path . '/functions.php';
} elseif ( str_contains( $wp_template_path, $extension ) ) {
$functions_path = $wp_template_path . '/functions.php';
if ( ! empty( $functions_path ) ) {
wp_create_nonce( 'theme-resume-error_' . $theme ),
// Load the theme's functions.php to test whether it throws a fatal error.
if ( ! defined( 'WP_SANDBOX_SCRAPING' ) ) {
define( 'WP_SANDBOX_SCRAPING', true );
$result = wp_paused_themes()->delete( $extension );
'could_not_resume_theme',
__( 'Could not resume the theme.' )
* Renders an admin notice in case some themes have been paused due to errors.
* @global string $pagenow The filename of the current screen.
* @global WP_Paused_Extensions_Storage $_paused_themes
function paused_themes_notice() {
if ( 'themes.php' === $GLOBALS['pagenow'] ) {
if ( ! current_user_can( 'resume_themes' ) ) {
if ( ! isset( $GLOBALS['_paused_themes'] ) || empty( $GLOBALS['_paused_themes'] ) ) {
'<p><strong>%s</strong><br>%s</p><p><a href="%s">%s</a></p>',
__( 'One or more themes failed to load properly.' ),
__( 'You can find more details and make changes on the Themes screen.' ),
esc_url( admin_url( 'themes.php' ) ),
__( 'Go to the Themes screen' )
'paragraph_wrap' => false,