批量删除或替换WordPress文章内容中文字方法
很多网站站长表示如何能批量删除文章内容中的一些文字呢?今天就微慕小程序为大家分享批量删除或替换WordPress文章内容中文字方法。
将下面这段代码添加到你当前使用的WordPress主题的 functions.php 文件中:
function replace_text_xintheme($text){
$replace = array(
//’关键词’ => ‘将要替换的关键词’
‘资源下载’ => ‘暂停下载’,
‘WordPress’ => ‘WordPress主题’,
);
$text = str_replace(array_keys($replace), $replace, $text);
return $text;
}
add_filter(‘the_content’, ‘replace_text_xintheme’);
add_filter(‘the_excerpt’, ‘replace_text_xintheme’);
发表评论
评论列表(2)
jianbo
2021.5.11 09:05
不错
骑驴倒上树~?
2021.4.19 17:04
好