0
我有了这个代码片段,在the_content(取代具体词):WordPress的与链接内容的链接替换标签字
function link_words($text) {
$replace = array(
'google' => '<a href="http://www.google.com">google</a>',
'computer' => '<a href="http://www.computer.com">computer</a>',
'keyboard' => '<a href="http://www.keyboard.com">keyboard</a>'
);
$text = str_replace(array_keys($replace), $replace, $text);
return $text;
}
add_filter('the_content', 'link_words');
我想用get_the_tags()为$替换数组,因此它会用指向其标记归档的链接替换特定的标记词。
问题尚不清楚。给一些示例 – JYoThI