#56213 closed defect (bug) (invalid)
Type of the response code and message in wp_remote_request()
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | HTTP API | Keywords: | |
| Focuses: | Cc: |
Description
https://developer.wordpress.org/reference/functions/wp_remote_request/
'code' (int|false) HTTP response code.
'message' (string|false) HTTP response message.
code/message can never be false though?
Change History (4)
Note: See
TracTickets for help on using
tickets.
Hey @malthert, thank you for creating the ticket.
Both
codeandmessagecan actually be set tofalse. This is happening for example in the following part of functionWP_Http::request()that is called bywp_remote_request().https://github.com/WordPress/wordpress-develop/blob/6.0/src/wp-includes/class-wp-http.php#L424-L435
3rd party developers can also use the filter
http_responseto tweak the returned array (including thecodeandmessagefields).