Publishing WordPress gallery posts on Discourse

Hello,

I’ve been using the “WP Discourse” plugin for months now, and it has always worked well with articles composed of galleries plus paragraphs.

I published an article on the blog containing only a gallery of about 60 images, but it is not being displayed on Discourse in the linked topic. Instead, it extracted the text from a GDPR plugin first, and then the footer text.

How can I resolve this? Do I need to add some code to the theme’s functions.php file?

I look forward to your reply. Thank you very much :slightly_smiling_face:

I specify the links to the related Forum post

Hi, any news?

I think the problem is on Discourse but I don’t know how to fix it.

Can anyone help please? :folded_hands: Thank you

Hey @FrancescoM,

Just to clarify what your issue is, you’re saying that

  1. You have been using the Publish functionality of the WP Discourse plugin for some time.
  2. You created this post with a gallery of images in Wordpress and it published to Discourse as this topic.
  3. The preview text in the first post of the Discourse topic is “Excalibur Hybrid X – Photos and shooting test” and when you click “Show Full Message” you see “© 2026 La Balestra Moderna. Copying, publishing, reproducing, or redistributing the contents in any way or form is prohibited.”

I gather that you’re saying that the issue is 3? Specifically, you’re expecting to see the images when you click “Show Full Message”. Is that right?

Hi @angus and thank you for your answer :folded_hands:

Yes that’s correct. For previously published posts, everything worked fine. I see both the gallery and the text after clicking the “Show Full Post” button.

I’ve attached a working example post here, both on WordPress and Discourse.

In this post there are photos as Gallery and some text.

If the post contains only images (inserted as Gallery), Discourse displays either the footer text or the message in the “Moove GDPR Cookie Compilation” plugin popup. If I disable the GDPR plugin, I see the footer.

If I insert an images as “Photo” (Gutenberg Block), Discourse will show the image but not the Gallery.

How can I fix this? Thanks again :folded_hands:

The difference is that in the case you reported the Wordpress post only has images in it. In this other case the post also has text in it. Would it be possible to add text before the images in the post you’re having an issue with?

Yes, I added some text before and after the gallery block, but on Discourse I saw only that text, without the images.

This is the text I added on the post before the “Gallery” block:

Excalibur Hybrid X – Foto e prova di tiro

Am I doing something wrong? Or do I need to delete the post and publish it again?

Thank you :folded_hands:

Yes, I would suggest publishing the post again with some text and the images and see if that fixes it. If that doesn’t work we can investigate other options.

I just deleted the topic on Discourse and added some text before and after the Gutenberg “Gallery” block, but unfortunately, it didn’t work. The content is clearly visible in the summary, but as soon as I click the button, it’s replaced by the GDPR plugin message.

Here’s the link to the new topic:

What can I do now to investigate and resolve the issue? I alsoi cleared the cache of WordPress (LiteSpeed and Cloudflare).

Do you need my WP-Discourse settings?

Thanks again :folded_hands:

Looks like you didn’t make a new post on Wordpress. If you re-use the same post on Wordpress the same preview content is going to be cached. Try making a new post on Wordpress with the same photos but with text at the start.

I created this post here on WordPress

And the topic linked here

But it’s not working. Maybe I need to insert more text? Or it should be showing anyway?

Thanks again :folded_hands:

The basic issue is that the way content is pulled from your site is that it uses a gem called Readability which is based on the Mozilla reader view algorithm.

Essentially what is happening here is that the readability algorithm doesn’t play nicely with image-heavy content. The preview feature is intended for posts that are mostly text.

Basically, yes. One way to test is to use the reader view in Firefox with your Wordpress post to see what the readability gem is likely to produce.

Thank you very much for the detailed answer @angus :folded_hands:

Can I edit this Readability test in Discourse?

Also I’ll do some tests by adding text and some descriptions and I’ll let you know.

Thank you again!

You can control the HTML selectors Readability looks at to scrape the content with these site settings:

  • allowed_embed_selectors
  • blocked_embed_selectors
  • allowed_embed_classnames
  • embed_title_scrubber

But these won’t directly affect how Readability handles images.

Thank you so much :folded_hands:

I noticed that Firefox Readability Mode doesn’t show on that Gallery Post, I’ll try to add more text and also some image descriptions…

But first I’ll take a look at these settings.

Thank you again for your help, I’ll let you know!

I noticed that I can only find “allowed_embed_selectors” in my Discourse settings.

I changed that by inserting CSS classes from my theme. Also, I used some “tricks” in order to increase readability score and it worked!

I added more text, some image alts and a global “wrapper” for posts to add an <article> tag. It’s working very well on Discourse, even if Firefox shows the GDPR panel as the “readable” content.

I have now a question. Can I extend the Discourse lightbox to the WordPress image imported on the topic?

Thanks again for your help! :folded_hands:

Hi, some updates here.

I noticed that WP-Discourse comments use <article> tag, and 1h ago a member inserted a comment, and the parser selected that text as the main content for the post.

I had to edit the plugin file in order to change the tag, but I know that for next update the edits will be lost.

Is it possibile to fix this parsing problem forever?

Thank you :folded_hands:

The way it works is that the HTML preview in the post retains fidelity with the original content. You’d need a custom plugin to do this.

The basic problem is the same. Trying to get a Wordpress post that is almost entirely images to be 1:1 between Wordpress and Discourse is not what the software is designed for. The reason topic embeds (what powers this on the Discourse side) uses the Readability gem is that the assumption is that you’re dealing with content that is read (i.e. text).

It would be possible to have a reliable photo gallery sync between Wordpress and Discourse, however you’d need to design the customisations (Wordpress plugin and Discourse plugin) to work that way.

Hi @angus and thank your for the clarification.

Do I need to make changes to the WP-Discourse plugin?

Also, is there any way other than CSS selector in order to customize how Discourse data is fetched or handled?

Thanks again for your help :folded_hands: