Discourse box in Wordpress Edit Page empty on one page

Hopefully the answer to this is simple, and I’m just missing something.

I’m using WP-Discourse with my webcomic site. So far, it works like a charm. But one of the pages my assistant created recently won’t let me link to Discourse. The box is in the sidebar of the Edit Page screen, but it’s empty.

On all my other pages, including new ones I’ve created myself after I created this page, that box gives me a checkbox to link the post to my Discourse install and the dropdown menu of what topic to link the post to. This one doesn’t.

Also, for this one odd page, I noticed this in the custom fields:

So, that’s probably the issue. But I’m not sure how to troubleshoot it. I didn’t create this page, but I don’t see any unusual entities or anything else different about this page.

Do you have any suggestions for how I should troubleshoot this?

That seems to be a bug. I’m looking into it now.

This is a bug that affects posts published with the Classic Editor when an unexpected error is returned from Discourse. It’s due to an update I made for the Block Editor that allows for handling of specific error messages.

Can you try clicking the Delete button underneath the wpdc_publishing_error field? Doing that should cause the Discourse metabox to display the publishing form again after you refresh the page. See if you are now able to publish the post.

A possible cause of the Unprocessable Entity error is that your forum was offline when the post was published. I’ll update the plugin today so that it has a default case to handle all possible errors.

Thank you for your help with this.

The good news is that when I deleted that error box and Updated the page, I immediately got the full Post on Discourse box.

Unfortunately, when I checked the box to post on Discourse, and updated again, the error box in the Custom Fields returned (same text).

And there was this error up top:

2019-01-24_14-09-58

Is there something else I should try?

Thanks for trying that. Until I get the plugin updated, the Discourse metabox will be empty any time that error is returned. Deleting the wpdc_publishing_error custom field will cause the metabox to re-appear.

Would it be possible for you to try publishing a new post from WordPress to Discourse? I’m curious if it will work.

What version of Discourse are you on?

I’m happy to try to help in any way I can. :slight_smile:

My Discourse install is v2.2.0.beta9 +29.

My WP-Discourse plugin is Version 1.8.3

Wordpress is 5.0.3.

I just tried creating two new pages in the same webcomic Collection and posting to Discourse. Both posted to my Discourse Topic without any issues.

1 Like

If you update to the latest version of the plugin (1.8.4) the Discourse meta box should now display correctly for the post that is returning the error. This won’t fix the issue of that post not publishing to Discourse though.

Since post custom fields are displayed for you on the edit page, could you check the value of the following fields if they are present:

  • discourse_permalink
  • discourse_post_id
  • publish_post_category

It would be great if you could let me know what you find.

If any of those fields are set, try deleting the fields and then republishing the post.

I’ve upgraded to the latest version of the plugin, and the meta box does indeed display again.

Only one of those fields was present – publish_post_category. Here is a screenshot of what I’m seeing:

I deleted the publish_post_category and hit Update, and got an error:

2019-01-24_22-10-13

Does that help at all? Do you think we should just delete the page and start over?

I’m unsure why the ‘Unprocessable Entity’ error is being returned. Is there something different about this post’s content than other posts that you have been able to publish successfully?

Is the author of this post able to publish other posts to Discourse? If they aren’t able to, I would expect the error to be ‘Forbidden’, not ‘Unprocessable Entity’, but it might be worth checking that.

Sure, give it a try and let me know what happens.

As far as I can tell, there isn’t anything different about the post’s content, and my assistant published it under my name. It is the cover page of the first chapter of a Patreon-locked comic, and being the cover, it’s unlocked. But the same thing is true for the cover of the second chapter, and that looks like it’s working with Discourse just fine: it links to a post there, etc.

And I just noticed something. When I went to make sure the cover for Chapter 2 posted on Discourse correctly, I decided to double-check to see if the cover for Chapter 1 also posted, even though the post itself on WP didn’t show the link. Sure enough, there’s a linked post on Discourse from 5 days ago when my assistant first created the page. The linked URL is the same URL of the post in WP.

Sorry I didn’t see that before. There are a lot of pages in this comic. And I was so focused on the broken meta box, I just assumed it had never posted in my Discourse.

I just linked the WP post to the already existing post on Discourse, and it connected just fine. I even changed some content on the WP page and was able to “Update Discourse topic” without issue.

Not sure why the post wasn’t already linked when I checked it and found the broken meta box. But I think we might have solved this mystery of why I couldn’t publish the post to Discourse now. Sorry again for not realizing there was already a post on Discourse.

Maybe there’s a way to make the error more specific in these cases? Something like “Error: Post Already Exists on Discourse. Please use link.”?

1 Like

Great! Yes, there should be an error message displayed to handle this case. The correct action to fix it is exactly what you did - link the post to its associated Discourse topic.

Thanks for reporting this. I wouldn’t have noticed the error that was preventing the metabox from displaying without the report.

3 Likes

My pleasure. Thank you very much for all your help—and the super-awesome plugin! :smiley:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.