I’m experiencing an issue with the Discourse WordPress plugin when trying to publish a WordPress post to Discourse.
Issue Description:
When I create a new post on my WordPress site and check the “Publish to Discourse” option under the Discourse tab before publishing, the post successfully publishes to WordPress. However, the Discourse topic is not created at that time.
Later, if I edit the same post and go to the Discourse tab again, then click “New Topic” and publish to Discourse, the post does get created on the Discourse site. But this Discourse topic is not linked with the original WordPress post. There’s no permalink association or metadata saved back to the post.
Debug Findings:
While debugging, I noticed the call to: /wp-json/wp-discourse/v1/publish-topic
As you can see, the “permalink” field is empty. This appears to be the core reason the Discourse topic is created but not linked back to the WordPress post (i.e., the permalink isn’t stored in the postmeta, so the link between WP and Discourse is broken).
Could you please help investigate why the permalink is returning empty in the API response? Is there a plugin misconfiguration or a bug in the publishing workflow?
Let me know if you need any logs or further information. Appreciate your help!
Hello @techops, could you please share any relevant logs from WP Discourse > Logs in Wordpress. Please also share the meta file from that view if possible.
Thanks for sharing that. Those logs look normal to me. I can see that a Discourse topic is being created after a Wordpress post is published. Could you confirm exactly what the issue is? Please describe it in these terms:
I compose a post in Wordpress.
After the post is published I expect to see…
Try not to make any technical assumptions at this stage. Thanks!
Hi Angus,
I composed a post in WordPress.
After the post is published, I expect to see the following behavior:
When the checkbox under ‘Publish to Discourse’ is checked, the correct behavior is that a post is created in Discourse, and it should be linked with the post in WordPress.
However, what actually happens is that the post is created in Discourse, but the link is immediately lost. It then has to be manually recreated.
Which Wordpress post composer are you using? Classic or Gutenberg? Are these posts being created in an non-standard way (e.g. I see you’re using “Gravity Forms Advanced Post Creation”)
Can you share an example Wordpress post and Discourse topic where this issue is occuring?
Are you using any plugin that modifies Wordpress meta fields (e.g. Advanced Custom Fields)?
We are using the Gutenberg editor for creating posts.
We are not using any custom field plugins such as Advanced Custom Fields.
I’ve recorded a video replicating the issue for your review. You can check it here.
Let me know if you need any additional information or further testing.
If it helps, I can also provide temporary login access so you can explore the setup directly.
Are you able to try publishing posts without this custom workflow? The way we will get to the bottom of this is a process of elimination. It is likely that one of your customisations is not interoperable with the WP Discourse publish feature set.
Ok, please keep going in that vein. One of your customisations is likely preventing the WP Discourse plugin from saving the post_id and the permalink when a topic is published.
I’ve identified the culprit, the SmartCrawl SEO plugin is conflicting with WP Discourse. After deactivating SmartCrawl, the posts are publishing to Discourse as expected and linking correctly to the WordPress posts.
Well done on finding the culprit. I think at this point it might be worth running this by their support team, i.e. “Your plugin seems to be stopping another plugin from using standard wordpress apis…” and then describe the issue. You can point them to this topic perhaps.