个人技术分享

WordPress插件:链接自动识别转为超链接
image.png

<?php

function open_links_in_new_tab() {
    add_filter('the_content', 'make_clickable');
    function autoblank($text) {
        $return = str_replace('<a', '<a target="_blank"', $text);
        return $return;
    }
    add_filter('the_content', 'autoblank');
}
add_action('init', 'open_links_in_new_tab');
?>