我正在我的网站中创建一个链接 URL,并在博客中将其用作 anchor 标记的 href。
这是我的网址在网站中的样子
https://www.mywebsite.com/sets/get-the-look-bella-hadid---london/4558
将其传递到博客后,链接会解析为如下内容
https://www.obsessory.com/sets/get-the-look-bella-hadid ——伦敦/4558
我不明白为什么它会将 --- 转换为 — ?
有人在任何地方遇到过同样的问题吗?
人们投票结束问题,尝试理解这个问题。
最佳答案
我猜您正在使用 WordPress?文本编辑器会自动处理连字符和破折号 - 正如许多其他编辑器所做的那样。
https://codex.wordpress.org/Function_Reference/wptexturize这在 WordPress 中发挥了神奇作用。
您可能需要将链接插入为链接。请参阅https://en.support.wordpress.com/links/
或者在functions.php中你可以禁用这个魔法(但真正的链接是更好的选择):
remove_filter( 'the_title', 'wptexturize' );
remove_filter( 'the_excerpt', 'wptexturize' );
remove_filter( 'the_content', 'wptexturize' );
关于javascript - - - - 正在转换为 — 同时传递给 href,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45049244/