# 发布到 Wordpress 时图片链接不显示

**URL:** https://meta.discourse.org/t/image-links-not-appearing-when-published-to-wordpress/267681
**Category:** WordPress
**Created:** [2023年六月8日 15:43 UTC](https://meta.discourse.org/t/image-links-not-appearing-when-published-to-wordpress/267681 "2023-06-08T15:43:31Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![anon48433008](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anon48433008](https://meta.discourse.org/u/anon48433008)
#### Post date: [2023年六月8日 15:43 UTC](https://meta.discourse.org/t/image-links-not-appearing-when-published-to-wordpress/267681/1 "2023-06-08T15:43:32Z")

</div>

首先，为实现这一切的人们献上赞美，这是一个很棒的资产。 👏

我发现已发布的帖子（到 Discourse）没有活动的图片链接。有没有办法让图片链接在从博客传输到论坛时保持活动状态？

我的“允许的 iframe”设置为允许域名，我是否遗漏了什么？

[https://blog.full30.com/fathers-day-keeping-it-real](https://blog.full30.com/fathers-day-keeping-it-real)

> **[Sixguns Firearm Fraternity](https://sixguns.com/)**
>
> A self supporting firearms community

我注意到一张来自亚马逊的图片根本没有发布。

谢谢

罗伯特

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [2023年六月9日 07:38 UTC](https://meta.discourse.org/t/image-links-not-appearing-when-published-to-wordpress/267681/3 "2023-06-09T07:38:02Z")

</div>

嘿 @anon48433008，

为了确保我理解了您的问题，您能否详细说明一下您所说的“活动图片链接”是什么意思？我曾以为您指的是 iframe 中的图片或 GIF，但我没有在您链接的 Wordpress 帖子中看到任何此类内容。

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2023年六月9日 08:17 UTC](https://meta.discourse.org/t/image-links-not-appearing-when-published-to-wordpress/267681/4 "2023-06-09T08:17:40Z")

</div>

他们正在讨论嵌入到图片中的链接。

在他们的 WP 帖子中：

 ![image](https://global.discourse-cdn.com/meta/original/4X/8/f/a/8faa8cd054d79b58cc6d7a45d7da25259437b1e7.jpeg)

帖子发布到 Discourse 时，图片会从其链接中剥离：

没有链接 👇

 ![image](https://global.discourse-cdn.com/meta/original/4X/5/3/e/53ecd68db2f0898e6b8d492c763b1497874ac95e.png)

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [2023年六月9日 09:38 UTC](https://meta.discourse.org/t/image-links-not-appearing-when-published-to-wordpress/267681/5 "2023-06-09T09:38:25Z")

</div>

感谢 @Canapin。

@anon48433008 这种情况有几种可能，因为 [WP Discourse](https://github.com/discourse/wp-discourse) 插件会进行一些小的 HTML 解析，然后 Discourse 也会进行 HTML 解析和重新抓取。链接被剥离最有可能发生在 Discourse 的 HTML 解析和重新抓取过程中，即 Discourse 处理帖子中嵌入的 HTML 的方式。例如，请参阅：

> [@Embeds stripped when "show full post..." button is clicked](https://meta.discourse.org/t/embeds-stripped-when-show-full-post-button-is-clicked/104025):
>
> For example, I inserted a Youtube video inline in a WP post that got pushed to Discourse as a topic. When people click the “Show full post…” button, for some reason the Youtube video doesn’t come through. (I’m only guessing this is true for all embeds. Perhaps it’s a Youtube-specific problem?)

或者

> [@How to customize the text in an embedded post?](https://meta.discourse.org/t/how-to-customize-the-text-in-an-embedded-post/214826/7?u=angus):
>
> Thanks for explaining Kevin. There are no settings specifically directed at this issue, but there’s two ways you could approach this. Customize what HTML is pulled from your site The way embeds work is that they scrape the content from a site using the [Readability](https://github.com/cantino/ruby-readability) gem. The gem and it’s output use the following options to filter what HTML is scraped opts[:whitelist] = SiteSetting.allowed\_embed\_selectors if SiteSetting.allowed\_embed\_selectors.present? opts[:blacklist] = SiteSetting.blocked\_embe…

我的具体建议是，与其寻求“技术”修复，不如将链接与图片分开，例如在图片下方使用链接。我理解您希望将它们保持在一起，但在这方面，您将面临一场艰苦的战斗才能使其始终如一地工作。将它们分开可能会奏效。

本质上，Discourse 不追求导入帖子的 HTML 保真度。它追求的是讨论内容的保真度。您的 Wordpress 到 Discourse 的策略应考虑到这一点，这意味着您希望您的用户在 Wordpress 上阅读帖子，而 Discourse 上的版本仅作为讨论的参考。

---

<div class="post-metadata">

### Author: ![anon48433008](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anon48433008](https://meta.discourse.org/u/anon48433008)
#### Post date: [2023年六月9日 10:08 UTC](https://meta.discourse.org/t/image-links-not-appearing-when-published-to-wordpress/267681/6 "2023-06-09T10:08:38Z")

</div>

5x5

我将注意这一点，并可能在今后每个图片下方单独添加“赞助链接”。

感谢你们两位的反馈，我再次重申，我非常喜欢这次整合的努力 🤗

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2023年七月9日 10:09 UTC](https://meta.discourse.org/t/image-links-not-appearing-when-published-to-wordpress/267681/7 "2023-07-09T10:09:02Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
