WordPress会将半角标点符号自动转换成全角的,但并没有替换数据库里的信息,这样会导致一些技术文章的代码粘贴后出错,防盗版?解决方法:

1、 编辑 wp-includes/formatting.php 文件,找到以下代码:

    // static strings
    $curl = str_replace($static_characters, $static_replacements, $curl);
    // regular expressions
    $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);

正是 str_replace() 和 preg_replace() 两个函数在作怪。

2、 将相应语句注释,禁用自动替换功能:

    // static strings
    //$curl = str_replace($static_characters, $static_replacements, $curl);
    // regular expressions
    //$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);

OK,以后Wordpress在也不会自作聪明的将半角标点符号转换成全角标点符号了。
来源:
http://buyu.name/074.html

原创文章,转载请注明: 转载自素食勤俭敬老孝慈

本文链接地址: 禁止WordPress自动替换半角标点符号

文章的脚注信息由WordPress的wp-posturl插件自动生成

Tags:

477 views

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <font color="" face="" size=""> <span style="">