gpt4 book ai didi

php - 从 Microsoft Word 发布博客时出现格式错误

转载 作者:可可西里 更新时间:2023-11-01 13:50:37 26 4
gpt4 key购买 nike

我在 wodpress.stackexchange.com 上发布了这个问题,但没有得到任何回复。

我意识到这可能是 PHP 中的编程问题。

我正在尝试从 Microsoft Live Writer 将博客文章发布到基于 wordpress 的网站。这是我在 Microsoft 中添加并发布的示例文本。

" Temporary Blog Post
I am adding a temporary blog post here
Let’s see how it goes
Thanks"

然而,当我发布帖子时,它是这样的

/pI am adding a temporary blog post here
/ppLet’s see how it goes
/ppThanks

注意文本中添加的 \pp 标签。

知道格式错误背后的原因吗?我认为当您从 Microsoft Word 或 Microsoft Live Writer 发布时,它看起来应该与 Microsoft Word/Live Writer 中的一样。

更新:当我从其他发布软件(如 Windows Live Writer 等)发帖时遇到同样的错误。

最佳答案

默认情况下,WordPress 在显示“the_content”时会自动在各处插入段落标签——这通常会妨碍您尝试分隔文本,并且还会产生验证问题(插入隐式 p 标签)。如果您想从您的内容中删除自动插入的段落标签,只需将此行插入模板文件中“the_content”标签上方:

<?php remove_filter (‘the_content’, ‘wpautop’); ?>

使用 cleanup_shortcode_fix()应该有助于解决您的问题的功能。

查看以下链接了解更多信息,

  1. Remove the p tags auto wrap
  2. Removing <p> and <br/> tags in WordPress posts
  3. wordpress-wrapping-shortcodes-with-p-tags
  4. Disable wpautop

希望这对你有帮助。

关于php - 从 Microsoft Word 发布博客时出现格式错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15319518/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com