我使用此代码在内容中自动链接单词
<?php function link_words($content){
$words=array(
\'test1\',
\'test2\',
\'test3\'
);
$links=array(
\'<a href="/tag/test1/" rel="nofollow">test1</a>\',
\'<a href="/tag/test2/" rel="nofollow">test2</a>\',
\'<a href="/tag/test3/" rel="nofollow">test3</a>\'
);
$content = str_replace($words,$links,$content);return $content;}
add_filter(\'the_content\',\'link_words\');
add_filter(\'the_excerpt\',\'link_words\'); ?>
但是上面的代码有一个问题,所以更改并链接了任何单词(图片alt,…)<我只想知道<p></p>
我希望最终将内容中的任何单词链接到标记和类别