WordPress每次更新手动修改的几个原文件


Wordpress更新WordPress的更新越来越频繁,虽然更新的方法非常多,也非常简单。但是自己手动更改的Wordpress原文件在每次更新后都会被“新的”原文件覆盖。为了不往functions.php里面添加不必要的代码,还是得老老实实每次更新都手动更改几个原文件。


1.增加Wordpress编辑器单篇文章“分页”按钮

wordpress 3.5

wp-includes\class-wp-editor.php

第391行
wordpress 3.2.1

wp-admin\includes\post.php

第1537行
添加'wp_page'
更加详细内容——《WordPress单篇文章分页及Feed全文输出


2.给“继续阅读”添加nofollow属性

wp-include\post-template.php

WordPress 4.0 第289行,添加rel=\"nofollow\"


3.Wordpress在新窗口打开留言者链接

wp-includes\comment-template.php

第155行,添加target='_blank'
现在用W3C新标准的external了,所以不用再添加target=’_blank’了。


4.Wordpress禁止英文标点自动转化为全角符号

wp-includes\formatting.php

170-174行(WordPress 4.0以上版本,174行的内容被分割为多个部分,全部注释),注释掉。

// This is not a tag, nor is the texturization disabled static strings
// $curl = str_replace($static_characters, $static_replacements, $curl);
// regular expressions
// $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);

或者主题添加function.php添加:

remove_filter( ‘the_title’ , ‘wptexturize’ );
remove_filter( ‘the_content’ , ‘wptexturize’ );
remove_filter( ‘the_excerpt’ , ‘wptexturize’ );
remove_filter( ‘comment_text’ , ‘wptexturize’ );

不是每一个WordPresss版本都有效。