我正在使用下面的代码使链接在 WordPress 标题中可链接。例如,它成功地变成http://google.com
了google.com。但是当我将多个网址放在标题中时,它只会更改第一个。有没有办法让它在所有链接上重复操作?
<script type="text/javascript">
jQuery().ready(function() {
jQuery("p.wp-caption-text").each(function(n) {
this.innerHTML = this.innerHTML.replace(new RegExp(" http://([^ ]*) "), " <a href=\"http://$1\">$1</a> ");
});
});
</script>