将以下代码添加到当前主题的 functions.php 文件中保存
/* 文章指定关键词添加内链开始 - 模板团*/
function replace_text_wps($text){
$replace = array(
'模板团' => '<a href="https://www.mbtuan.com/" rel="external nofollow" target="_blank" title="模板团">模板团</a>',
'WordPress' => '<a href="https://www.mbtuan.com/college/wp" rel="external nofollow" target="_blank" title="WordPress">WordPress</a>',
'网站模板' => '<a href="https://www.mbtuan.com/template" rel="external nofollow" target="_blank" title="网站模板">网站模板</a>'
);
$text = str_replace(array_keys($replace), $replace, $text);
return $text;
}
add_filter('the_content', 'replace_text_wps');