WP-Discourse Plugin Preventing Post Editing

Hello. I am recently getting an error from the WP-Discourse plugin that is preventing me from editing a blog post. I was recently upgraded to WP5 and also updated my DIVI theme. I suspect this has something to do with the error, but I’m not sure how to fix it.

My Discourse forum is hosted on Digital Ocean. I use the plugin so my users can share their same login from my WP site.

When I disable the plugin I do not get the error, but I cannot leave it disabled for obvious reasons. The error I get is (URL blocked out):

TypeError: Cannot read property ‘indexOf’ of null
at DiscourseSidebar.isAllowedPostType (webpack-internal:///43:977:51)
at DiscourseSidebar.updateStateFromDatabase (webpack-internal:///43:937:22)
at new DiscourseSidebar (webpack-internal:///43:903:17)
at zf (https://XXXXX.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:69:258)
at Mf (https://XXXXX.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:87:4)
at ph (https://XXXXX.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:98:474)
at eg (https://XXXXX.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:125:307)
at fg (https://XXXXX.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:126:168)
at wc (https://XXXXX.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:138:237)
at fa (https://XXXXX.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:137:115)

I am also including a screenshot of what I see when I try to open a blog post in my editor. I never get to the post in order to edit it.

Thank you for any help you can offer!

1 Like

Is the error only happening for a particular post, or do you get it with all posts? What is the post-type of the post you are trying to edit?

Are you using the Divi visual builder for creating posts?

It happens for all posts. The post-type is just a blog post. I usually use the visual builder, but in this case I cannot even get that far. When I am in the list of posts in the dashboard, I click a post title to open it and that is when the error occurs.

1 Like

I’m testing the plugin with the Divi theme now. So far I’m not getting the error you’re describing. What verson of the Divi theme are you using? I’m testing it with version 3.22.4.

Even if I can’t reproduce the error, it should be possible to fix it. The WP Discourse plugin shouldn’t be trying to access the index of a null value. The error message you have supplied should be enough to fix the issue. I’ll let you know when that’s been done.


I’ve found the bug. I’ll try to get the fix for it into the WordPress repo later today. Until then, if you could go to the WP Discourse Publishing settings tab and enable any of the post types you see in the ‘Post Types to Publish’ option, you should be able to edit your posts. Posts won’t be published to Discourse unless you click the ‘Publish’ button on the editor’s Discourse sidebar.


Thank you! That is awesome. I was about to start replying to your posts when I saw you fixed the bug.

I am not trying to publish anything to Discourse. These are just WordPress blog posts. I use the plugin only to help share the login with my WP site and my Discourse forum. I will try what you suggested, but I just wanted to clarify that I am not trying to post to Discourse.

Thank you again!


This worked! I can’t thank you enough.

1 Like

That’s great! Thanks for reporting this.

By default there is always 1 post type enabled. I hadn’t tested the code for the case where no post types are enabled. For that case, the script that is causing you the trouble shouldn’t be loaded at all. This will be fixed in the next update - probably later today. I’ll let you know when that’s been done so that you can remove the post type you’ve had to add to the ‘Post Types to Publish’ setting.


Just to follow up, There were no post types selected before. I had someone else set this up for me for the purpose of SSO, but I had never looked at the option. It was not a problem before, perhaps it changed with the new WordPress. I can’t be certain. In any case, it’s great that it’s working now. I don’t think there is a downside to just leaving those checked since I won’t be publishing anything. At least not for now.

Up until you updated to WordPress 5, this wouldn’t have caused any problems.

The issue has been fixed in WP Discourse version 1.9.0. It is available in the WordPress repo now.