[wp-trac] [WordPress Trac] #44174: wp_get_http_headers does not return status code or follow redirects
WordPress Trac
noreply at wordpress.org
Fri Aug 22 10:01:47 UTC 2025
#44174: wp_get_http_headers does not return status code or follow redirects
--------------------------+------------------------------
Reporter: tlhackque | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone: Awaiting Review
Component: HTTP API | Version: 4.9.6
Severity: normal | Resolution: invalid
Keywords: | Focuses:
--------------------------+------------------------------
Changes (by pmbaldha):
* status: new => closed
* resolution: => invalid
Comment:
We can get the response code of the remote request by following the code
below:
{{{#!php
<?php
$args = [
'timeout' => 1,
'sslverify' => false,
];
$response = wp_remote_get( 'https://prashantwp.com/', $args );
$response_code = wp_remote_retrieve_response_code( $response );
}}}
The wp_get_http_headers() function is not intended to get the response
code, so I am marking this ticket as invalid.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44174#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list