An idea for more economical comments?

Currently, the way the WordPress and Discourse link works is that every article is automatically transferred to Discourse as hidden. So even those where no discussion is going on.

Which is very resource-intensive, as WordPress creates many “empty” topics.

Can anyone think of a solution to make it so that only articles where discussion has started are transferred from WP to Discourse?

Hey @Petr_Mišák,

To do that you’d need to have comments created on Wordpress be imported as posts into Discourse. That’s not possible using the WP Discourse plugin and unlikely to be supported in the near future. For some broader thoughts on this see

That said, it occurs to me that once we add the ability for Discourse category actors to follow other ActivityPub actors to the ActivityPub plugin (which I’m currently working on) you could perhaps configure the Wordpress ActivityPub plugin in some way to achieve this. Although this is quite speculative.

I’d also want to understand a bit more why you see this as “resource intensive”. If you’re publishing a lot of articles that aren’t getting engagement, perhaps consider publishing a subset of your articles to your forum that are more likely to get engagement? Conversely is having a lot of embedded topics with no replies hurting your community in some way you’ve observed? Is there perhaps something you can do to address the underlying issue here so to speak?

1 Like

For context, I believe you have a popular WordPress site with lots of posts, and have recently created a Discourse forum and added the Discourse WordPress plugin to your website.

How many posts are on your WordPress site? Do older posts receive comments very often, or do people usually just comment on newer posts?

In terms of solutions to the problem, would you consider a solution that required adding custom code to the WordPress site, or are you only interested in ways of doing this that don’t require any custom code?

If posts on the site normally only receive comments for a short period of time after they are published, the easiest possible solution would be to just start publishing the site’s most recent posts to Discourse.

The next easiest thing to do would be to add a plugin to your site that modified the WP Discourse “Start Discussion” link, so that instead of being a link to the Discourse topic, it would be a link that triggered the WP Discourse plugin to publish the post to Discourse. The trickiest part of implementing this would be to figure out how to handle the case of the user who first clicks the “Start Discussion” link - should they be automatically redirected to the topic once it has been published, what will they see while the topic is being published, etc.

Another possible solution that wouldn’t require a custom WordPress plugin, but would require some possibly expensive developer time, would be to get someone to write an import script that would import all of your site’s existing posts, comments, and users to Discourse. That would take care of the issue of empty topics. If this approach was taken, it might be worth considering using your WordPress site as the DiscourseConnect provider for your Discourse site. That would make it easy for the imported users to get access to Discourse.

2 Likes

Empty topics don’t consume many resources. Are you talking about tens or hundreds of thousands?

1 Like

It’s possible it’s just a translation error on my part, but I’m not interested in posting WordPress comments in Discourse, but only in Discource to discuss the article topics in WordPress.

In order to do so, I need the WordPress plugin to insert a hidden topic into Discourse for each published article after it is published.

It just bothers me terribly that the linking between the WordPress article and the comments in Discourse is created at the time the article is published, and not when someone expresses interest in discussing the topic.

Considering that only 10% of all articles have people commenting, but the WordPress plugin creates a link in Discourse for every article published. So 90% of the links created in this way remain hidden and just take up resources unnecessarily.

We publish about 13 articles every day. So 13*365=4,745 articles per year. And out of these 4,270 will be set up as hidden topos in the Discourse system and will never have a comment added to them. That’s 42,700 trash topics in 10 years.

The solution would be if the hidden topic in Discourse would not be created when the article is published in WordPress, but the topic would only come in when someone in WordPress under the article shows interest in commenting on it.

So there would be no need to create hidden and unused threads in Discourse.

It’s exactly as you say, we have a very visited WordPress site, but we are moving user accounts, logins, article comments completely to Discourse. WordPress will become just a “DiscourseConnect Client”.

We publish about 13 articles per day :slight_smile:

People usually comment on new articles, but it is not uncommon for a discussion to develop on an older article. We try to update articles once they have been published several times over time. And newly added information to an article can reignite discussion.

We are happy to add a piece of code to WordPress.

Using the current WordPress plugin for Discourse, we plan to only add new articles to Discourse that have been published since 11/1/2023, but this will create thousands of unused topics in Discourse. Additionally, if someone wants to comment on an article from 2015, they won’t have a way to do so since the topic won’t exist in Discourse.

It would be great if the topic was created only when the user clicks on “start a discussion under the article”

How do I roughly imagine the whole process would work? I’ll give an illustrative if fictional example.

  • In WordPress we have a draft article for example www.SvetAndroida.cz/android-telefony-2023
  • we will publish the article
  • still nothing is transferred to Dicourse

Then someone clicks on the “Start a discussion” button under the WordPress article

  • at that point WordPress calls Discource to create a topic with the address komunita.SvetAndroida.cz/android-telefony-2023
  • and after it is created, it redirects the user to Discourse to post the first comment

If someone on the same WordPress article wants to “add a comment” (another comment)

  • they will no longer call Discourse and create a topic
  • but the user will be taken directly to the Discourse when the button is clicked
  • alternatively the “add comment” button no longer needs to be handled by JavaScript, but since the topic already exists, the button could just be an html link, which would be better from an SEO perspective

Using JavaScript would only create a new topic in Discourse if someone clicked “Start Discussion” and wanted to add the first comment.

We can probably do the whole solution ourselves, but we currently have a shortage of WordPress programmers. Additionally, it would be great if this functionality was included directly in the official Discourse plugin.

2 Likes

In our case it would be about 50,000 topics in 10 years

That’s not that big a deal, but you could purge the ones a few years old once a year.

Cleaning it up would make sense, but we try to update old articles and activate the discussion after some time since publication. So deleting is not an ideal solution in our case. …

This all makes sense, particularly for dealing with previously published articles. My only concern is that by relying on custom code, you will add some complexity to your WordPress/Discourse integration. I think it should be fine though. Make sure your developers use the WP Discourse plugin’s action and filter hooks and don’t edit the core plugin’s code. They’ll need to figure out how to call the public sync_to_discourse method when the “start discussion” link is clicked: wp-discourse/lib/sso-client/sso-client-base.php at main · discourse/wp-discourse · GitHub. By publishing via that method, all the appropriate meta data will get added to the WordPress post.

That’s great! It might be worth looking at this Discourse site: boing - Boing Boing BBS. They use the WordPress plugin to publish a similar number of articles to Discourse. For their case, they automatically publish all new articles to Discourse. They haven’t published articles to Discourse that were created on WordPress prior to their having setup a Discourse site.

2 Likes

Is there any suitable place on this forum where I could get a developer to modify the WordPress plugin for Discourse as described above?

1 Like

Thanks, you were very quick. I was originally looking for it in the categories but couldn’t find it there. Which surprised me. But the search helped.

Thanks for your detailed response Petr, however I’m a little confused.

How would someone express interest in discussing an article if you don’t want Wordpress comments and there isn’t already a topic for it in Discourse?

*edit Ah I see you’ve laid out a UX

Yes, that’s quite doable.

Thinking about this now, I think perhaps it’s a little lacuna in the plugin that we don’t have an easier way to do this. I think it makes sense to add a utility function and a shortcode and block that connects to it. I’ll investigate this for the release after the current one.

4 Likes

Great idea to add support to the official WordPRess plugin for Discourse. Is there any approximate idea in which version of the plugin and how long it might take to get this new feature?

I’m going to start working on this next week to be added in 2.5.1 (the release after next). @Petr_Mišák You’ll be able to use this to achieve your goal.

3 Likes

Great, I’m looking forward to it. We already have Discourse deployed on the main site https://www.svetandroida.cz/