функция
since 2.7.0
wp_remote_retrieve_response_code()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
wp_remote_retrieve_response_code( array|WP_Error $response ): int|string
Описание
Возвращает пустую строку, если передано неверное значение параметра.
Оригинал (английский)
Will return an empty string if incorrect parameter value is given.
Параметры
$response
array|WP_Error
обязательный
HTTP-ответ.
Возвращаемое значение
int|string
Исходный код
wp-includes/http.php:282
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. |

