function replace_text_wps($text){
$replace = array(
'关键词' => '<a href="https://yijile.com/tag/wordpress/" rel="tag" >关键词</a>',
'WordPress主题' => '<a href="https://www.ztjun.com/theme" rel="category tag" >WordPress主题</a>',
'WrodPress教程' => '<a href="https://www.ztjun.com/wplearn" rel="nofollow" target="_blank" >WrodPress教程</a>'
);
$text = str_replace(array_keys($replace), $replace, $text);
return $text;
}
add_filter('the_content', 'replace_text_wps');
使用方法
将下面代码粘贴到自己使用的Wordpress主题的functions.php文件中。