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)
是什麼意思?