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