WP Discourse plugin installation and setup


(Frank Bailey) #61

Hi yes, sorry, it’s a dev environment. Thanks for the very useful reply! I’m researching the viability of using Discourse and WordPress as a replacement for a Ning community for a client.

Interestingly, the error thrown is “You are not permitted to view the requested resource. The API username or key is invalid.” I’ve double-checked the API key and it’s definitely correct. I regenerated a new key just in case and it still gives the same error.

Here’s the full debug log on the off-chance it might contain any information I’m not picking up on. debuglog.txt (3.6 KB)

(Simon Cossar) #62

Is the API username on WordPress the username of a Discourse admin user?

Are you using the Discourse All Users API key?

Does the user who is publishing the posts from WordPress have an account on Discourse? Go to your profile page on WordPress, scroll down and look for the Discourse Username field. Make sure the entry in that field matches your Discourse user’s username.

(Frank Bailey) #63

Hi again Simon. I hit upon this solution literally one minute before I saw your reply. The username I had set up wasn’t the correct username from Discourse. I changed that and my posts are now being added to Discourse. Thanks very much for your help, sir!

(Simon Cossar) #64

That’s great. The plugin can probably provide an admin notice on the post edit page that gives some hints about what to look for in cases like this.

(Frank Bailey) #65

That’s a neat idea. Before I get out of your hair once and for all, I’d just like to ask whether it takes a while for comments on a post to show up on WordPress? I’ve set all the minimum levels to 0 so it should theoretically pull across all comments, right?

(Simon Cossar) #66

By default, comments are cached on WordPress for 10 minutes. There are a couple of workarounds for this. There is a filter applied to the comment sync period. In development mode, you can set the comment_sync_period to 0 by adding something like this to your functions.php file:

add_filter( 'wpdc_comment_sync_period', 'wpdc_custom_comments_sync_period' );
function wpdc_custom_comments_sync_period() {
	return 0;

You can also setup a Discourse webhook, so that comments are synced automatically when a post is added on Discourse. Look at the WP Discourse Webhook options tab for details about how to set that up. The setting is called Sync Comment Data.


I can’t believe it: this entry was assigned with “display: none” in the regular Enfold CSS file. Still wondering why one would do that… :thinking:

(Tumi) #68

Hello guys -) this plugins seems to be good but wait…
Pls show me a real value for conecting Wordpress for Discourse. Why i dont see it…
Duplicate content ?? somethnk similar like IP.blog ?? I asking seriously what is the real power oh this plugin (btw nice work for empleyers)

Value of integrating Discourse and WordPress
(Simon Cossar) #69

Hi Tumi, it has other uses, but the original intention behind it was to make it possible to use Discourse comments for WordPress posts.

Yes, it is nice work for employees :slight_smile:

(Erlend Sogge Heggen) #73

A post was split to a new topic: Value of integrating Discourse and WordPress

(Robert Brockie) #74

The plugin seems to be working great, however it seems the comments coming from Discourse are not being encoded properly…

06 PM

(Simon Cossar) #75

Thanks! That’s the second report I’ve had of that. I haven’t yet been able to reproduce the problem, but it’s fairly clear where it’s happening. I’ll try to get a fix out tomorrow.

(Simon Cossar) #76

I managed to reproduce the issue. The problem was happening on servers that have the libxml php extension enabled, but have a libXML version < 2.8.0. The latest version of the WP Discourse plugin (1.5.5) should fix the problem for you. It’s available in the WordPress plugin repository now.

(Robert Brockie) #77

Many thanks @Simon_Cossar!

(Andrew ) #78

I am now following up on this and trying to add 3 subsites to the multisite WP install. The plugin has gone through several updates since this conversation (it was at 1.4.x at the time). Currently, I have Discourse options on the Network Admin page and on Subsite Admin pages. Is this the expected behavior? In the context of our conversation some months ago, I now find myself thoroughly confused.

(Simon Cossar) #79

I’ll get back to you early next week about this.

(Andrew ) #80

No hurry. Thanks for all the work you put into this.

I’ll try to reduce the scope.


I am using Discourse as the SSO provider to WordPress. Currently, I have this set at the Network level in the plugin settings. This appears to be functioning as expected.

It seems that my current setup reflects the intended behavior. That is based on this note in the plugin options of the subsites:

You are using the WP Discourse plugin in a subsite of a multisite installation. The plugin’s API credentials are being managed through the installation’s main site. If you have difficulty connecting to the Discourse forum. Please contact the network administrator.

If that is correct, then my first observation is that there doesn’t seem to be a way to change the Publishing Username on the subsites. In my scenario, each subsite is owned by a separate Discourse user who is a human who wants to be associated with their blog posts. Ideally, each post they make from their subsite would be published to Discourse as their own username.


If I disable the multisite option in Network, the subsite Publishing Username reverts to the desired subsite behavior. However, the tab to put WP in SSO Client mode disappears. Does using Discourse as SSO Provider only work if Enable Multisite Configuration is selected in the Network settings? The SSO settings are still present in the Network UI when it isn’t selected.

In other words

As I alluded to initially, part of my confusion relates to our earlier discussion which included discussion of filters to exempt some subsites from the multisite config.

Is it possible to get these three behaviors simultaneously:

  1. Each subsite publishing to Discourse as Username of the subsite owner
  2. Discourse as SSO Provider for all WP subsites
  3. Advanced. One subsite publishing to an entirely different Discourse install

(Simon Cossar) #81

5 posts were merged into an existing topic: Link existing forum topic to new WordPress post