# wp_remote_retrieve_response_code()

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

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

## Сигнатура

```php
wp_remote_retrieve_response_code( array|WP_Error $response ): int|string
```

## Описание

Возвращает пустую строку, если передано неверное значение параметра.

## Параметры

- `$response` `array|WP_Error` — обязательный. HTTP-ответ.

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

`int|string`

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

Файл: `wp-includes/http.php:282`

```php
function wp_remote_retrieve_response_code( $response ) {
	if ( is_wp_error( $response ) || ! isset( $response['response'] ) || ! is_array( $response['response'] ) ) {
		return '';
	}

	return $response['response']['code'];
}
```

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

- 2.7.0 — Introduced.

## Связанные

Использует: [`is_wp_error`](https://chugunov.pro/api-wordpress/functions/is_wp_error/).
Используется в: `WP_AI_Client_HTTP_Client::create_psr_response`, `WP_Font_Collection::load_from_url`, [`wp_get_https_detection_errors`](https://chugunov.pro/api-wordpress/functions/wp_get_https_detection_errors/), `WP_Site_Health::check_for_page_caching`, `WP_REST_URL_Details_Controller::get_remote_url`, `WP_Site_Health::wp_cron_scheduled_check`, `WP_Site_Health::get_test_rest_availability`, `WP_Site_Health::can_perform_loopback`, [`wp_check_php_version`](https://chugunov.pro/api-wordpress/functions/wp_check_php_version/), `WP_Community_Events::get_events`, [`populate_network`](https://chugunov.pro/api-wordpress/functions/populate_network/), [`get_core_checksums`](https://chugunov.pro/api-wordpress/functions/get_core_checksums/), [`wp_check_browser_version`](https://chugunov.pro/api-wordpress/functions/wp_check_browser_version/), [`download_url`](https://chugunov.pro/api-wordpress/functions/download_url/), [`wp_credits`](https://chugunov.pro/api-wordpress/functions/wp_credits/), [`url_is_accessable_via_ssl`](https://chugunov.pro/api-wordpress/functions/url_is_accessable_via_ssl/), [`wp_get_http`](https://chugunov.pro/api-wordpress/functions/wp_get_http/), `WP_SimplePie_File::__construct`, [`wp_version_check`](https://chugunov.pro/api-wordpress/functions/wp_version_check/), [`wp_update_plugins`](https://chugunov.pro/api-wordpress/functions/wp_update_plugins/), [`wp_update_themes`](https://chugunov.pro/api-wordpress/functions/wp_update_themes/), `WP_oEmbed::_fetch_with_format`, `WP_HTTP_IXR_Client::query`, [`_fetch_remote_file`](https://chugunov.pro/api-wordpress/functions/_fetch_remote_file/).

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