# resume_theme()

URL: https://chugunov.pro/api-wordpress/functions/resume_theme/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 5.2.0.

## Сигнатура

```php
resume_theme( string $theme, string $redirect = '' ): bool|WP_Error
```

## Описание

Если был указан редирект и найден файл functions.php, сначала мы убеждаемся, что файл functions.php больше не вызывает фатальных ошибок.
Это работает так: перед попыткой подключить файл перенаправление устанавливается на ошибку. Если тема завершается сбоем, перенаправление не будет перезаписано сообщением об успехе, и работа темы не будет возобновлена.

## Параметры

- `$theme` `string` — обязательный. Одна тема для возобновления работы.
- `$redirect` `string` — необязательный, по умолчанию `''`. URL для перенаправления.

## Возвращаемое значение

`bool|WP_Error` — $theme WP_Error

## Исходный код

Файл: `wp-admin/includes/theme.php:1169`

```php
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 ) ) {
		$functions_path = '';
		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_redirect(
				add_query_arg(
					'_error_nonce',
					wp_create_nonce( 'theme-resume-error_' . $theme ),
					$redirect
				)
			);

			// Load the theme's functions.php to test whether it throws a fatal error.
			ob_start();
			if ( ! defined( 'WP_SANDBOX_SCRAPING' ) ) {
				define( 'WP_SANDBOX_SCRAPING', true );
			}
			include $functions_path;
			ob_clean();
		}
	}

	$result = wp_paused_themes()->delete( $extension );

	if ( ! $result ) {
		return new WP_Error(
			'could_not_resume_theme',
			__( 'Could not resume the theme.' )
		);
	}

	return true;
}
```

## История изменений

- 5.2.0 — Introduced.

## Связанные

Использует: [`wp_paused_themes`](https://chugunov.pro/api-wordpress/functions/wp_paused_themes/), [`wp_redirect`](https://chugunov.pro/api-wordpress/functions/wp_redirect/), [`__`](https://chugunov.pro/api-wordpress/functions/__/), [`wp_create_nonce`](https://chugunov.pro/api-wordpress/functions/wp_create_nonce/), [`add_query_arg`](https://chugunov.pro/api-wordpress/functions/add_query_arg/), `WP_Error::__construct`.

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/resume_theme/
