I have integrated a WordPress posts into discourse. In one of the posts I have added a wistia video. It’s working fine in WP posts. but in discourse its showing only the image. The video is not showing and instead of that an image is being loaded.
Thanks for asking about this. While looking into the issue I came across a problem with how the Discourse WordPress plugin is handling YouTube and Vimeo embeds. The fix for that issue might also solve the problem with displaying Wistia videos for topics that are published from WordPress.
I’m assuming you are publishing the posts from WordPress to Discourse with the WP Discourse plugin and that you have enabled the “Use Full Post Content” option that is found on the WP Discourse Publishing options tab. I am also assuming you are using the WordPress block editor and not the Classic editor. Let me know if that is not correct.
If that is how you are publishing the WordPress posts to Discourse, how are you adding the Wistia videos to the WordPress posts? Are you using the “share” link or are you using the video’s embed code to add the videos? I think it’s going to be possible to get this to work if the “share” link is used, but not if the embed code is used.
For (my own) reference, the issue with YouTube and Vimeo videos is here:
When this code was added to the plugin, WordPress video blocks were named based on the video provider. For example core-embed/youtube. WordPress now seems to use the name core/embed for video blocks and specify the provider with the providerNameSlug attribute. For example:
Hi @simon … Thanks for the reply…
Yes…I am publishing the posts form WordPress to discourse with WP Discourse plugin. But I haven’t enabled the “Use Full Post Content” option since I am using short codes in WP editor.
I am currently using WP classic editor…
I am using Wistia embed code to WP editor to add video.
I have tried the solution that you have mentioned but didn’t made any change…
That is a more difficult issue to solve. Currently all iframes are being stripped by Discourse when a post is displayed on Discourse after a user clicks the “Show Full Post” button. This means that videos from any source will fail to appear in the topic. It would be great if this could be made to work. I know it’s been asked for a few times.
The reason this is happening is because the “Show Full Post” button on an embedded post in Discourse works by “re-crawling” the embedded webpage when the user clicks it. The HTML you see when you click that button is not being sent by the WP Discourse plugin when the post is published, it’s a fresh crawl of the relevant page.
Web crawling is always a bit hit and miss due to the wide variety of possible HTML structures (e.g. there are many different ways of displaying images in HTML). Because of this, this is a feature that is being considered for a possible improvement. See further
So there isn’t currently an easy solution. You can attempt to block and allow HTML selectors the crawler uses, however this is a tricky thing to get working in the way you want. See further
A simpler way of addressing this is to either hide the “Show Full Post” button, or override it so it links back to the original Wordpress post, using a custom theme component. When a site has a relatively complex post HTML structure involving images, like yours, I tend to advise these latter options.