[wp-hackers] wp_remote_request not telling me the 301'd URL

Dion Hulse (dd32) wordpress at dd32.id.au
Mon Feb 28 12:41:12 UTC 2011

wp_remote_head() will ignore redirects entirely (ie. it returns the headers
of the exact url you request.)
wp_remote_get() will treat a max-redirections-exceeded as a failed request,
which makes sense under normal situations. However, returning a "normal"
style return in the WP_Error error_data field may make life easier for

On 28 February 2011 20:37, Scott Kingsley Clark <scott at skcdev.com> wrote:

> So with a site setup using alternative permalink structures (rather than
> the
> default ?p=X), when you go to a URL with that ?p=X on it, it will redirect
> you to the correct URL. What I'm seeing though is while my browser may do
> this, and headers checks appear to do this, the wp_remote_request returns a
> 200 and the content of the final URL. If I set the $options array to set
> 'redirection' to 0, then I get a WP_Error, neither of which tell me the new
> URL. I tried to get the information from wp_remote_request, through the
> 'response' / 'headers' keys of the returned array.
> Anyone have any tips on how to use wp_remote_request AND get the
> destination
> URL?
> -Scott Kingsley Clark
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list