WP Discourse "Update Discourse topic" error

Hi,

I am create blog post and linked existing topic. Discourse topic not updated, blog post url not seems on the topic.

Also, i tried “Update Discourse topic” on Wordpress panel. It gives me error:

There has been an error publishing this post to Discourse.

Reason for failure:
A 422 response code was returned from Discourse.
Unprocessable Entity

Any ideas?

1 Like

When you link a post to a Discourse topic, it does not update the topic until you select the ‘Update Discourse topic’ checkbox. Linked posts do not add the blog URL to the Discourse topic.

Can you try this with another post and see if you get the same error?

1 Like

I selected ‘Update Discourse topic’ checkbox. When i tried another post, it works.

Thanks for trying that! Can you give any details about the post that is returning the 422 error? Does the topic that it is linked to exist on your forum?

We are finding this problem right now, and I think I can contribute to this discussion. What happened in our case is:

  1. An article is published in WordPress and a related topic is automatically created in Discourse.
  2. However, for whatever reason (user post limit?), the new topic goes automatically to moderation.
  3. The moderated topic is not public, The WP-Discourse plugin cannot “see it” and throws a first error message: Reason for failure: A bad response was returned from Discourse. Check that: - your Discourse forum is online.

If the moderator approves the post because everything is correct there, then…

When updating the article in WordPress in order to have a Discourse topic linked, the WP-Discourse plugin finds an article with an identical title / content, and this is what cause a second error message:

Reason for failure:
A 422 response code was returned from Discourse.
Unprocessable Entity

The solution is to delete the first Discourse topic and update the page again.

2 Likes

Thanks for mentioning this. If a post that is published to Discourse gets added to the Needs Approval queue, the WordPress plugin should give some feedback about how to deal with it.

After the post has been approved you can also select the ‘Link to Existing Topic’ option from the post’s Discourse metabox. In the Topic URL field, enter the URL of the approved Discourse topic.

2 Likes

Yeah, I wonder why occasionally a post of these goes to moderation. It is sent by a trusted user. Maybe there is some kind of throttle? Several posts might be queued in WordPress, and then an administrator reviews them and might approve several of them pretty quickly.

Not in our case because we have the “Force publish” option enabled. Therefore the metabox only says.

The force-publish option has been enabled. All WordPress posts will be published to Discourse in the Kaosenlared category.

Once you know what is going on, it is not a big deal.

When posts that are published from WordPress to Discourse get added to the Discourse approval queue, the user publishing the post should now see this message:

When the topic is approved on Discourse and the Topic URL is updated on WordPress, they will see this:

Let me know if you are finding any posts that are added to the approval queue on Discourse but are not displaying this message on WordPress.

4 Likes

I have a similar issue in combination with a glossary plugin
Whenever I try to create a new topic from the post or update it, I get the same error:

A 422 response code was returned from Discourse. Unprocessable Entity

Also my server’s CPU goes crazy and my DB cannot be reached for a minute or two.

Any way I can debug that?

Are you able to publish any posts when the glossary plugin is enabled? What is the name of the plugin? Are you using the WordPress Block Editor, or the old Classic Editor?

I am using the classic editor
Plugin: https://www.cminds.com/wordpress-plugins-library/tooltipglossary/

Yes. As long as the [glossary] shortcode is not in the post, it works fine.

1 Like

How large is the glossary you were adding? I just tried the plugin with two items in the glossary and adding the shortcode to a post didn’t cause a problem.

around 70 entries are in it

Hey there

the issue reappeared again, this time I am not using the glossary shortcode at all.
I tried to update this post: Kaufberatung: Welche Growbox (Growzelt) für Indoor Growing? | CannabisAnbauen.net

I need to update it since I enabled “use full post content”
How can I debug the issue?

Are you getting the A 422 response code was returned from Discourse. Unprocessable Entity error when you try to update the post?

yes, exactly. every time I try to update the discourse topic

Could you try temporarily unchecking the ‘Use Full Post Content’ setting on WordPress and then updating the post again? If you don’t get any errors when you try that, then we’ll know that the problem is related to the content of the post. If you do get errors, then the problem will be related to the post’s metadata.

1 Like

When unchecked, I am not getting any errors! So it’s content related…

1 Like

Is there anything in the content of that post that stands out as different from the content of posts that you have successfully published?

I think it might be shortcode related. I am using a plugin to display multiple product boxes via shortcodes called Affiliate Toolkit: Das Affiliate Wordpress Plugin für Amazon, eBay, Zanox, affilinet, CJ,... mit Preisvergleich > affiliate-toolkit.com

I also observed a huge spike in CPU usage once I click the button to update the post.

I just tried a different article where only one simple formatting shortcode is used and it worked fine.