<p>最近工作不是很忙,决定研究下wordpress</p><p>
</p><p>先来个简单的,后台添加插件</p>
<?php
/*
Plugin Name: tbtest_hello
Plugin URI: 插件的介绍或更新地址
Description: 插件描述
Version: 插件版本,例如 1.0
Author: 插件作者名称
Author URI: 插件作者的链接
License: A "Slug" license name e.g. GPL2
*/
function tbtest_hello_function($text){
$text=str_replace('welcome','hehe',$text);
return $text;
}
add_filter('the_content','tbtest_hello_function');
这样后台就可以看到一个插件,你启用之后,对post的content页面就会有正则替换的效果。