WordPress中的标点符号转换 – 2

以前提到过 wordpress 会把诸如 “–” 之类的符号自动替换成 “—” 等全角字符,解决方法是在 formatting.php 中修改 wptexturize() 函数,但这样子修改,每次wordpress升级都会被覆盖。于是就想写个插件解决。但用插件的话就只能把整个 wptexturize() 都禁用掉。这个函数的其它部分是一堆转义代码,一时看不懂什么意思,担心禁掉后会不会被人在留言里用script渗透。就放在一边一直没有弄。刚刚看了看,应该和script没关系,可以完全禁掉的。
然后发现早在07年,就有先贤写过一个只有三行的叫做 Disable wptexturize 的插件,用来禁掉这个函数。但是….为什么这个插件也叫做wptexturize?也就是说只有已经知道了这个函数的存在的人,才能够搜索到这个插件,而通过其它如 “disable auto format / convert” 之类的关键字,基本上是搜不到的。
程续缘真是可悲的物种啊。

Comments

One response to “WordPress中的标点符号转换 – 2”

  1. Tintin Avatar

    晕,我正在手动修改替换
    那个是全角符号,貌似不是全角的减号,因为页面搜全角的减号也搜不到
    这个可能是看起来更方便一些,当一堆减号的时候,效果就出来了。

Leave a Reply

Your email address will not be published. Required fields are marked *

Your post must include a link to this post.

How does this work?
Write a response on your own website and include a link to this post. Then submit your response’s URL here. Your response may appear here after moderation. To update or remove it, edit or delete your original post and submit the same URL again. Learn more about Webmentions.