wp_remote_retrieve_response_message()WP 2.7.0

Retrieve only the response message from the raw response.

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

No Hooks.

Return

String. The response message. Empty string on incorrect parameter given.

Usage

wp_remote_retrieve_response_message( $response );
$response(array|WP_Error) (required)
HTTP response.

Changelog

Since 2.7.0 Introduced.

Code of wp_remote_retrieve_response_message() WP 6.0

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

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