
打开function.PHP文件,加入以下代码:
function replace_text_wps($text){$replace = array(
// '替换前的内容' => '替换后的内容'
'wordpress' => '<a href="#">wordpress</a>',
'excerpt' => '<a href="#">excerpt</a>',
'function' => '<a href="#">function</a>'
);
$text = str_replace(array_keys($replace),$replace,$text);
return $text;
}
add_filter('the_content','replace_text_wps');
add_filter('the_content','replace_text_wps');
保存文件。成功!
总结以上是内存溢出为你收集整理的WordPress 快速替换全部文章中的内容代码全部内容,希望文章能够帮你解决WordPress 快速替换全部文章中的内容代码所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)