# wp_check_php_version()

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

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

## Сигнатура

```php
wp_check_php_version(): array|false
```

## Описание

Проверяет, нужно ли пользователю обновить PHP.

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

`array|false` — recommended_version stringВерсия PHP, рекомендуемая WordPress. minimum_version stringМинимально необходимая версия PHP. is_supported boolАктивно ли поддерживается версия PHP. is_secure boolПолучает ли версия PHP обновления безопасности. is_acceptable boolОстаётся ли версия PHP приемлемой или следует показать предупреждения и рекомендовать обновление.

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

Файл: `wp-admin/includes/misc.php:1581`

```php
function wp_check_php_version() {
	$version = PHP_VERSION;
	$key     = md5( $version );

	$response = get_site_transient( 'php_check_' . $key );

	if ( false === $response ) {
		$url = 'https://api.wordpress.org/core/serve-happy/1.0/';

		if ( wp_http_supports( array( 'ssl' ) ) ) {
			$url = set_url_scheme( $url, 'https' );
		}

		$url = add_query_arg( 'php_version', $version, $url );

		$response = wp_remote_get( $url );

		if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
			return false;
		}

		$response = json_decode( wp_remote_retrieve_body( $response ), true );

		if ( ! is_array( $response ) ) {
			return false;
		}

		set_site_transient( 'php_check_' . $key, $response, WEEK_IN_SECONDS );
	}

	if ( isset( $response['is_acceptable'] ) && $response['is_acceptable'] ) {
		/**
		 * Filters whether the active PHP version is considered acceptable by WordPress.
		 *
		 * Returning false will trigger a PHP version warning to show up in the admin dashboard to administrators.
		 *
		 * This filter is only run if the wordpress.org Serve Happy API considers the PHP version acceptable, ensuring
		 * that this filter can only make this check stricter, but not loosen it.
		 *
		 * @since 5.1.1
		 *
		 * @param bool   $is_acceptable Whether the PHP version is considered acceptable. Default true.
		 * @param string $version       PHP version checked.
		 */
		$response['is_acceptable'] = (bool) apply_filters( 'wp_is_php_version_acceptable', true, $version );
	}

	$response['is_lower_than_future_minimum'] = false;

	// The minimum supported PHP version will be updated to at least 8.0 in the future. Check if the current version is lower.
	if ( version_compare( $version, '8.0', '<' ) ) {
		$response['is_lower_than_future_minimum'] = true;

		// Force showing of warnings.
		$response['is_acceptable'] = false;
	}

	return $response;
}
```

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

- 5.1.1 — Added the 'wp_is_php_version_acceptable' filter.
- 5.1.0 — Introduced.

## Связанные

Использует: [`set_url_scheme`](https://chugunov.pro/api-wordpress/functions/set_url_scheme/), [`wp_http_supports`](https://chugunov.pro/api-wordpress/functions/wp_http_supports/), [`wp_remote_get`](https://chugunov.pro/api-wordpress/functions/wp_remote_get/), [`wp_remote_retrieve_response_code`](https://chugunov.pro/api-wordpress/functions/wp_remote_retrieve_response_code/), [`wp_remote_retrieve_body`](https://chugunov.pro/api-wordpress/functions/wp_remote_retrieve_body/), [`set_site_transient`](https://chugunov.pro/api-wordpress/functions/set_site_transient/), [`add_query_arg`](https://chugunov.pro/api-wordpress/functions/add_query_arg/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/), [`get_site_transient`](https://chugunov.pro/api-wordpress/functions/get_site_transient/), [`is_wp_error`](https://chugunov.pro/api-wordpress/functions/is_wp_error/).
Используется в: `WP_Site_Health::get_test_php_version`, [`wp_dashboard_php_nag`](https://chugunov.pro/api-wordpress/functions/wp_dashboard_php_nag/), [`dashboard_php_nag_class`](https://chugunov.pro/api-wordpress/functions/dashboard_php_nag_class/), [`wp_dashboard_setup`](https://chugunov.pro/api-wordpress/functions/wp_dashboard_setup/).

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