function replace_text_wps($text){
$replace = array(
// 'WORD TO REPLACE' => 'REPLACE WORD WITH THIS'
'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_excerpt','replace_text_wps');
这段代码用来替换一些单词,为什么他使用add_filter()函数两次,他错了吗?为什么add_filter()被应用两次?
另外,行$text = str_replace(array_keys($replace), $replace, $text)
是什么意思?