HTTP API: Improve docs for wp_remote_retrieve_header function return value.

This change updates the `@return` docs for `wp_remote_retrieve_header` to specify that an array can also be returned if the requested header key has multiple values.

Props robtarr, johnjamesjacoby, felipeelia, hellofromTonya, costdev.
Fixes #51736.

git-svn-id: https://develop.svn.wordpress.org/trunk@52441 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
David Baumwald 2022-01-04 18:52:43 +00:00
parent 7d4b63b317
commit 7009488561

View File

@ -222,7 +222,8 @@ function wp_remote_retrieve_headers( $response ) {
*
* @param array|WP_Error $response HTTP response.
* @param string $header Header name to retrieve value from.
* @return string The header value. Empty string on if incorrect parameter given, or if the header doesn't exist.
* @return array|string The header(s) value(s). Array if multiple headers with the same name are retrieved.
* Empty string if incorrect parameter given, or if the header doesn't exist.
*/
function wp_remote_retrieve_header( $response, $header ) {
if ( is_wp_error( $response ) || ! isset( $response['headers'] ) ) {