# Cannot connect WP Discourse to Discourse forum

**URL:** <https://meta.discourse.org/t/cannot-connect-wp-discourse-to-discourse-forum/51119>\
**Category:** WordPress\
**Created:** [5 أكتوبر 2016، 2:03م UTC](https://meta.discourse.org/t/cannot-connect-wp-discourse-to-discourse-forum/51119 "2016-10-05T14:03:01Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [7 أكتوبر 2016، 7:18ص UTC](https://meta.discourse.org/t/cannot-connect-wp-discourse-to-discourse-forum/51119/14 "2016-10-07T07:18:59Z")

</div>

From what I can figure out (this took a while), this is what’s causing the error:

It’s redirecting to Discourse. The plugin function that tests the connection to Discourse makes a request to `GET /users/system.json` when the settings page is saved. TheWordPress function `wp_remote_get` is used to make the request. It is set to follow a maximum of 5 redirections (that’s the default.) When HTTPS is enabled on the Discourse site, each time the function is run, it makes 5 requests to Discourse. Each request returns a `301` and a `549` status code. After five requests, the `wp_remote_get` function returns the ‘too many redirects’ error to WordPress. I don’t know why Discourse is returning the `549` status code.

Increasing the value for the allowable number of redirects just causes more requests to be made, but eventually results in the same error.

When HTTPS is not enabled on Discourse, everything runs fine.

The solution that working for me on the DigitalOcean setup is to install the `php-curl` extension and restart the server. Doing this makes the DigitalOcean 1 click WordPress install work with HTTPS enabled on both WordPress and Discourse. After enabling `php-curl` the request to Discourse is returning `200` and `2045`.

It looks like what is going on is that the WordPress HTTP API functions (they are used throughout the plugin for making API calls to Discourse) have a function called `_get_first_available_transport` that first tries to use `curl` but falls back to `streams` if `curl` isn’t available.

---

_[View the full topic](https://meta.discourse.org/t/cannot-connect-wp-discourse-to-discourse-forum/51119)._
