批量替换WordPress文章中的文字的方法
1、首先登录wordpress后台。
2、其次,打开模板编辑。
3、打开主题的functions.php文件。
4、将下面代码加到主题的functions.php文件中:functionreplace_text_wps($text){$replace=array(//'关键词'=>'替换的关键词' 例如:'wordpress'=>'<ahref="#">wordpress</a>','excerpt'=>'<ahref="#">excerpt</a>','function'=>'<ahref="#">function</a>');$text=str_replace(array_keys($replace),$replace,$text);return$text;}add_filter('the_content','replace_text_wps');add_filter('the_excerpt','replace_text_wps');
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:55
阅读量:42
阅读量:48
阅读量:63
阅读量:83