Loading
0

自动为wordpress文章内容的链接加上target=”_blank”

找到使用主题的functions.php文件,加入以下内容:

function addTarget($content) {    
 
$result = str_replace('<a', '<a target="_blank"', $content);    
 
return $result;    
 
}    
 
add_filter('the_content', 'addTarget'); 

最后编辑于:2023/2/23作者: joycode

我不入地狱,谁入地狱?

评论已关闭