WP Discourse now supports the WordPress Block Editor

WordPress 5.0 has been released. The biggest change is that it comes with a new Block Editor. The Block Editor only has limited support for meta-boxes. This breaks some of the functionality of the Discourse meta-box. To solve that problem, WP Discourse version 1.7.9 comes with a new Discourse Sidebar.

If you are publishing posts with the WordPress Classic Editor plugin, the old Discourse meta-box will be displayed and fully functional on your edit page. You can switch between the Block and Classic editors without any problems.

Opening the sidebar

If you are using the Block Editor, you will now see a Discourse button in the upper right of the post edit page:

Clicking the button opens the sidebar (you will only see the Tags section if you have enabled Tags in the Publishing Settings):

Publishing and linking posts

If you are creating a new post or draft, you can mark it to be published to Discourse when it is published on WordPress by selecting the Publish checkbox. If your post has already been saved on WordPress, but was not marked to be published to Discourse, you now publish it by clicking the Publish to Discourse button:

If instead of publishing your topic to Discourse, you want to link it to an existing topic, select the Link to Existing Topic radio button and copy the topic’s URL into the input. Click the button to link to the topic:

04%20PM

After attempting to link or publish a post, on success the sidebar will display something like this:

11%20PM

On failure, you will get a message that hopefully gives you some clue as to what went wrong:

48%20PM

Pinning topics

Posts can be automatically pinned when they are first published to Discourse. Select the Pin Discourse Topic checkbox and enter a date into the Pin Until input:

27%20PM

Tagging topics

If you have enabled the Allow Tags option (found on the Publishing Settings tab) topics can be tagged when they are first published to Discourse. To create a tag, type the tag name in the tag input. Hit your Enter key, or add a comma after the text to create a tag:

40%20PM

To remove a tag, click the ‘x’ button.

Updating and unlinking posts

To update or unlink a post from Discourse, click the Update or Unlink heading to expand the appropriate section and then click the button:

32%20PM

On success, you will see a message like this:

21%20PM

On failure you will see an error message:

20%20PM

Other changes

Publishing posts as unlisted topics is now set as a site wide option. To enable it, select the Publish as Unlisted Topics option on your Publishing Settings tab.

When using the Block Editor, the Auto Publish option is not respected. If the setting is enabled and the Block Editor is used to publish a post, the setting will be ignored. The Force Publish option is still respected.

If the full content of posts is published to Discourse (enabled by selecting the Use Full Post Content Publishing option) the content of the post will be filtered with the WordPress the_content filter. The reason for this is that the Block Editor adds a lot of markup to raw posts. Filtering posts with the_content removes the markup.

Let me know if you run into any issues with this update. As always, older versions of the plugin can be downloaded from the bottom of this page: https://wordpress.org/plugins/wp-discourse/advanced/.

13 Likes

Is there a reason for this?

The main reason is that it’s tricky to implement the setting in a way that will work with both editors. Before doing the work to implement it, I wanted to see if anyone missed having the feature.

Are you finding that authors are failing to publish posts to Discourse?

2 Likes

I’m using Classic. That said, I don’t want my authors to have to remember to check this box. It’s not a matter of them forgetting. It’s a matter of more hoops for them to jump through.

I suppose I would default to force publishing if I couldn’t have this feature, but I wouldn’t like it.