WordPress开发者和主题制作者的搜索引擎



wp_remote_retrieve_response_code ›

Since2.7.0
已弃用n/a
wp_remote_retrieve_response_code ( $response )
参数:
  • (array) $response HTTP response.
    Required: Yes
返回:
  • (int|string) The response code as an integer. Empty string on incorrect parameter given.
定义在:
文档:

Retrieve only the response code from the raw response.

Will return an empty array if incorrect parameter value is given.



源码

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

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