I'm working on a plugin that fetches remote RSS feeds using wp_remote_get. The problem is that Tumblr requires a cookie for GDPR compliance. This includes RSS feeds. Which means all Tumblr feeds are currently broken.

I found an example of using CURL to acquire the cookies so the feed will load. However, I have little more than a passing acquaintance with wp_remote_get and related functions.

How do I implement the cookie getting hack from the example via WordPress' remote get methodology?

Edit: To clarify, I need to get and then use a cookie. That's two requests; one for the cookie and a second using the cookie.


The arguments array for wp_remote_get accepts a cookies parameter:

$cookies = [];
$cookie = new WP_Http_Cookie( 'cookie_name' );
$cookie->name = 'cookie_name';
$cookie->value = 'your cookie value';
$cookie->expires = 7 * DAY_IN_SECONDS; // expires in 7 days
$cookie->path = '/';
$cookie->domain = '.reddit.com';
$cookies[] = $cookie;

$url = 'https://tumblr.com/some/url/';

$args = [
    'cookies' => $cookies,

$response = wp_remote_get( $url, $args );
|improve this answer|||||
  • Does that work for getting the cookie first? If so, how do I nab that? – Matthew Brown aka Lord Matt Jun 6 '19 at 21:50
  • 1
    Sorry, I think I misunderstood your request a little. To get the cookies from a wp_remote_request method such as wp_remote_get or wp_remote_post, you can access the cookies key of the returned array. e.g. $r = wp_remote_get( <url> ); print_r( $r['cookies'] ); – phatskat Jun 19 '19 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.