这不是问如何关闭自动段落格式
几乎相反 - 我正在使用 wpautop,但它并没有像我认为的那样做段落。
我遇到的问题是我的整个帖子被包装为一个<p>,然后<br />被用于所有换行符。
这是一个客户站点,已经移动了几次,最近从站点的最后一个版本的导出中导入了帖子。
<br />标签不存在于数据库字段中。我只能猜测 wpautop 的一些内部工作与某种特殊字符换行符对齐,这些换行符在所有迁移中被意外替换。
有人会对这是什么有明确的答案吗?如果您可以展示如何在不手动打开、重新格式化和重新保存数百个帖子的情况下修复它,则可以获得奖励积分。
为了清楚起见,我希望有正常的段落而不是br我现在得到的
更多信息
将帖子内容从 PHPMyAdmin 复制粘贴到 Notepad++ 时,它会在每行的末尾显示 (CR)(LF)。也许我对原因有误,因为它应该是这样的,对吗?
示例用法
正在做:
$product->get_description()
产量,如预期:
Happy birthday never tasted this good.
Topped with a hand piped personal message. These cupcakes are perfect for any birthday celebration and will put a smile on that special someone's face. A mix of chocolate and vanilla; like any good birthday cupcakes these are loaded with sprinkles!
与数据库中的字段完全匹配:
Happy birthday never tasted this good.
Topped with a hand piped personal message. These cupcakes are perfect for any birthday celebration and will put a smile on that special someone's face. A mix of chocolate and vanilla; like any good birthday cupcakes these are loaded with sprinkles!
但是做:
wpautop($product->get_description())
产量:
<p>Happy birthday never tasted this good.<br>
Topped with a hand piped personal message. These cupcakes are perfect for any birthday celebration and will put a smile on that special someone's face. A mix of chocolate and vanilla; like any good birthday cupcakes these are loaded with sprinkles!</p>
试图wpautop做到这一点,我认为这是预期的行为:
<p>Happy birthday never tasted this good.</p>
<p>Topped with a hand piped personal message. These cupcakes are perfect for any birthday celebration and will put a smile on that special someone's face. A mix of chocolate and vanilla; like any good birthday cupcakes these are loaded with sprinkles!</p>
几周以来,我一直坚持这一点。甚至可以接受导致更好调试的建议。