# Connect WP Discourse to Discourse

**URL:** https://meta.discourse.org/t/connect-wp-discourse-to-discourse/223490
**Category:** Administrators
**Tags:** wordpress, video, how-to
**Created:** [April 6, 2022, 12:52pm UTC](https://meta.discourse.org/t/connect-wp-discourse-to-discourse/223490 "2022-04-06T12:52:59Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [April 6, 2022, 12:52pm UTC](https://meta.discourse.org/t/connect-wp-discourse-to-discourse/223490/1 "2022-04-06T12:52:59Z")

</div>

After you’ve [installed the WP Discourse Plugin](https://meta.discourse.org/t/install-the-wp-discourse-plugin/223489) you need to connect it to your Discourse. When you’re ready to go, watch this short video, or follow the instructions below.

https://www.loom.com/embed/5e0dfa10de724d048108bd13247468aa

## Next Step

Once the plugin is connected, head over to the topic describing the feature you want to set up:

- [Publish posts to Discourse](https://meta.discourse.org/t/wp-discourse-and-publishing-posts-to-discourse/223492)
- [Use Discourse for Wordpress Comments](https://meta.discourse.org/t/wp-discourse-and-commenting/223493)
- [Log in to Discourse with Wordpress (DiscourseConnect)](https://meta.discourse.org/t/wp-discourse-and-discourseconnect/223494)

* * *

## Instructions

### Steps

When you’re looking at the `Connection` tab of the [WP Discourse](https://github.com/discourse/wp-discourse) plugin settings, there will always be a notice at the top of the page which will tell you whether it is connected to your Discourse. To establish a connection, enter:

1. Enter the URL of your forum in the `Discourse URL` settings field

2. Review the `Publishing Username` setting. Unless you have a specific reason to change this, keep it as “system”. If you change this it has to be a username of an admin user on your Discourse. You can find the username of a user under their name when you click on their avatar.

3. Create a Discourse API key for Wordpress:

4. Paste the API key into the `API Key` setting in [WP Discourse](https://github.com/discourse/wp-discourse).

When you’ve filled out these settings make sure you click the ‘Save Options’ button. If everything is correctly configured, you should see a notice that “You are connected to Discourse” at the top of the page.

### Multisite

The [WP Discourse](https://github.com/discourse/wp-discourse) plugin has a Multisite Configuration option for the case where one Discourse forum is connected to a network of multiple WordPress. This option is available on the Connection settings tab of the main site of a network.

Selecting it allows some of the plugin’s settings to be used over the entire network (all the connection options, the Webhook options, the [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) Secret Key, and Enable [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) setting) Enabling this setting will create an extra database table that’s used for associating Discourse topic\_ids with WordPress blog\_ids when posts are published from WordPress to Discourse.

#### Features not supported in Multisite

Using WordPress as a [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) Client is not supported on Wordpress Multisite.

### Granular API Key (new ✨)

You can now create a granular API key for the [WP Discourse](https://github.com/discourse/wp-discourse) plugin. Granular API keys will become the standard way to connect [WP Discourse](https://github.com/discourse/wp-discourse) to Discourse in the near future.

#### How to use a Granular key

Here’s how you can use a Granular key:

1. First, make sure you’re on version `2.4.3` of the plugin, and the latest version of Discourse on the `tests-passed` branch. [WP Discourse](https://github.com/discourse/wp-discourse) granular API keys are not yet supported on Discourse `stable`.

2. Go to the API panel in the Discourse admin dashboard and create a new “All Users” key, but with a “Granular” Scope.

3. At the bottom of the Scopes list you’ll find the Wordpress scopes. Select the “Publishing” scope (required at the moment), and scopes for any other features you’re using in the [WP Discourse](https://github.com/discourse/wp-discourse) plugin, and click “Save”.

4. Now replace your old key in the `API Key` setting in [WP Discourse](https://github.com/discourse/wp-discourse) with your new Granular key and save your settings.

When you save your [WP Discourse](https://github.com/discourse/wp-discourse) settings, you should see the normal “You are connected to Discourse!” message.

If you see “You are not connected to Discourse…” it may be because your scopes are incorrect. The plugin compares the scopes of your API key to the features you have currently enabled. If you have insufficient scopes, it will consider you to not be connected. You can see which scopes are missing by enabling the connection logs and looking at the error messages in the Logs viewer.

#### The [WP Discourse](https://github.com/discourse/wp-discourse) Scopes

There are four scopes for the [WP Discourse](https://github.com/discourse/wp-discourse) plugin:

1. Publishing. This scope allows you to publish posts from Wordpress to Discourse. This scope is required, even if you’re not publishing posts (e.g. only using [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true)) as it includes functionality that all features use. This will be decoupled in the future, making all scopes optional.

2. Commenting. This scope allows to show replies to posts published to Discourse in Wordpress as comments.

3. [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true). This scope allows to use [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) (in any configuration).

4. Utilities. This scope is needed for certain utility functions available in the plugin. If you have any custom code that interacts with the plugin you should enable this scope, unless you’re sure you don’t need it.

#### Why use a Granular key?

The primary reason to use a granular key is security. A Global API key allows anyone who has the key to act like an administrator on your Discourse. This means the security of your Discourse is dependent on the security of your Wordpress. A granular key is much less powerful, being limited to the scopes you enable for it.

---

<div class="post-metadata">

### Author: ![deepak\_dhamde](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@deepak\_dhamde](https://meta.discourse.org/u/deepak_dhamde)
#### Post date: [September 9, 2024, 5:49am UTC](https://meta.discourse.org/t/connect-wp-discourse-to-discourse/223490/2 "2024-09-09T05:49:26Z")

</div>

We are seeing an issue, while updating Posts on Wordpress is not updating related post on Discourse. We are getting following error in logs.

ERROR:  
publish.ERROR: update\_post.post\_error {“wp\_title”:"title … ",“wp\_author\_id”:“2205402”,“wp\_post\_id”:3179224,“response\_message”:“You are not permitted to view the requested resource. The API username or key is invalid.”,“http\_code”:403}

We are using Granular key to connect [WP Discourse](https://github.com/discourse/wp-discourse) to Discourse with “Wordpress Pubblishing” & “Wordpress Commenting” scopes. Can someone please help me with this?

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [September 9, 2024, 8:41am UTC](https://meta.discourse.org/t/connect-wp-discourse-to-discourse/223490/3 "2024-09-09T08:41:03Z")

</div>

Hello @deepak_dhamde I’m sorry you’re having an issue. I’m travelling today but will try to recreate your issue and get back to you first thing tomorrow.

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [September 10, 2024, 7:03pm UTC](https://meta.discourse.org/t/connect-wp-discourse-to-discourse/223490/4 "2024-09-10T19:03:10Z")

</div>

Hey @deepak_dhamde I’ve recorded a video of myself setting up a granular key with the scopes you’re using. If you could review and let me know if you’re doing anything differently.

https://www.loom.com/embed/d4e9724e6cd84f64be27c3215612ebb7

---

<div class="post-metadata">

### Author: ![deepak\_dhamde](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@deepak\_dhamde](https://meta.discourse.org/u/deepak_dhamde)
#### Post date: [September 16, 2024, 9:20am UTC](https://meta.discourse.org/t/connect-wp-discourse-to-discourse/223490/5 "2024-09-16T09:20:10Z")

</div>

Hi @angus, Sorry for late response.  
We are following exact same procedure to generate Granular Key but still seeing same 403 error in logs. When we update wordpress posts, the related topic on discourse is not getting updated.

ERROR:

[2024-09-16 06:51:28] publish.ERROR: update\_post.post\_error {“wp\_title”:“Testing update post feature on staging site”,“wp\_author\_id”:“2168699”,“wp\_post\_id”:3175772,“response\_message”:“You are not permitted to view the requested resource. The API username or key is invalid.”,“http\_code”:403}

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [September 16, 2024, 9:30am UTC](https://meta.discourse.org/t/connect-wp-discourse-to-discourse/223490/6 "2024-09-16T09:30:02Z")

</div>

Hey @deepak_dhamde.

There will likely be some small difference in the way you’re setting it up, or your environment. It’s hard for me to find that difference without more information. Here’s some ways we can move forward:

1. you could give me access to your environment (happy to sign an NDA) so I can take a look; or
2. you could record your own video of you doing the same thing I just did (send it to me privately); or
3. you can take another look and consider these factors:
  - Is your Discourse and Wordpress up to date?
  - Are you able to create a working “Global” key?
  - Have you tried getting different members of your team to do the same set of steps (sometimes a fresh set of eyes will see something new)
  - share the “meta” file in your [WP Discourse](https://github.com/discourse/wp-discourse) log viewer with me (i.e. your Wordpress environment) and I’ll see if anything stands out.

---

<div class="post-metadata">

### Author: ![deepak\_dhamde](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@deepak\_dhamde](https://meta.discourse.org/u/deepak_dhamde)
#### Post date: [September 16, 2024, 11:04am UTC](https://meta.discourse.org/t/connect-wp-discourse-to-discourse/223490/7 "2024-09-16T11:04:49Z")

</div>

Hey @angus ,  
We created a new Granular key, followed the procedure you mentioned in the video and enabled edit in post scope and it started working, Thank you very much for being so patient & supportive.

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [February 22, 2025, 7:20am UTC](https://meta.discourse.org/t/connect-wp-discourse-to-discourse/223490/8 "2025-02-22T07:20:41Z")

</div>

4 posts were split to a new topic: [Connecting WP Discourse to a local Discourse Instance running a specific version](https://meta.discourse.org/t/connecting-wp-discourse-to-a-local-discourse-instance-running-a-specific-version/353761)
