WP Discourse: can't access editor for post types created with Toolset Types plugin

Hi, I am using the WP Discourse plugin on a Wordpress 5.0.2 multisite, and have successfully had multiple sites on the network integrated with our Discourse instance. This works for default posts and pages, as well as for custom post types created by podcasting and event plugins.

However, on custom post types created with the Toolset Types plugin, I am not able to access the editor when enabling the WP-Disource plugin (v. 1.79 and 1.8). Unselecting WP Discourse for those content types restores access to the editor.

This occurs both in live and staging environments. The following error is from our staging:

. componentDidUpdate

zc@https://metapsy.theoryofetest.wpengine.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:146:367

wc@https://metapsy.theoryofetest.wpengine.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:138:274

fa@https://metapsy.theoryofetest.wpengine.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:137:117

gg@https://metapsy.theoryofetest.wpengine.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:135:198

Ca@https://metapsy.theoryofetest.wpengine.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:133:367

enqueueSetState@https://metapsy.theoryofetest.wpengine.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:191:326

setState@https://metapsy.theoryofetest.wpengine.com/wp-includes/js/dist/vendor/react.min.js?ver=16.6.3:20:319

promiseReactionJob@[native code]


Thanks for any help.

1 Like

Thanks for reporting this. I’ve installed the Toolset Types plugin on my dev site and created a basic post type. What I’m finding is that when I create a new post with the post type, the Classic Editor opens for me and I’m able to create the post and publish it to Discourse without any problems. This even happens when I disable the Classic Editor plugin. Is there a setting I need to enable to use the Block Editor with the Toolset Types plugin?

Can you give some more details about your custom post type settings?

Which version of Toolset Types are you using? I’m testing this with the free version 2.3.5.

Edit: It looks like the error message you have posted is missing some infomation. There should be an error message at the beginning of it that looks something like this:

TypeError: Cannot read property 'status' of undefined
at DiscourseSidebar.componentDidUpdate 

Could you try creating the error again and see if there’s more information there? If there’s nothing there, could you open your browser’s web inspector and look at its console tab for an error message?

1 Like

Hi Simon, Thanks for looking into this. We are using Toolset Types 3.2.4, which is the latest release of the premium version. I believe I can get you the files for troubleshooting, as well as our configuration. You have also just reminded me that Toolset Types has its own configuration option to force the Block or Classic editor or allow selection on a Per Post basis for its custom post types. I do not have the Classic Editor plugin installed, but Toolset provides the same functionality.

I had the Block editor selected for the post types displaying the conflict. Switching to Classic allows the editor to load. Switching to Per Post allows loading the editor when the Classic editor is selected on a post, but not when the Block editor is selected, which displays the error again.

Regarding the error, you’re right, here is the full output:

TypeError: Cannot read property 'discourse_post_id' of undefined
    at DiscourseSidebar.componentDidUpdate (webpack-internal:///43:1199:61)
    at zc (https://metapsy.theoryofetest.wpengine.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:146:349)
    at wc (https://metapsy.theoryofetest.wpengine.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:138:272)
    at fa (https://metapsy.theoryofetest.wpengine.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:137:115)
    at gg (https://metapsy.theoryofetest.wpengine.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:135:196)
    at Ca (https://metapsy.theoryofetest.wpengine.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:133:365)
    at Object.enqueueSetState (https://metapsy.theoryofetest.wpengine.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:191:324)
    at DiscourseSidebar.q.setState (https://metapsy.theoryofetest.wpengine.com/wp-includes/js/dist/vendor/react.min.js?ver=16.6.3:20:304)
    at eval (webpack-internal:///43:924:25)
1 Like

Thanks! That error message might be all that I need. I’ll get back to you about this soon - possibly not until Monday though.

5 Likes

Can you try updating to WP Discourse Version 1.8.1? That should fix the error you were getting. To get post types created with Toolset to work correctly with the WP Discourse plugin, you also need to enable Custom Fields for the post types. You can enable custom fields by going to Toolset / Edit Post Types, and then selecting the Custom Fields checkbox.

Let me know if you’re still having trouble with this.

5 Likes

Hi Simon, that solved the issue for me. Thanks!

1 Like

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