• Very useful plugin!

    Please include option to manage external links inside the_content.

    For now, I am doing this:

    function bem_crawl_content($text) {
        $search = '/<a.+?href="(http(s)?:)?\/\/(?!.*?MY-SITE\.com.*?").*?>/i';
        preg_match_all($search, $text, $matches);
    
        foreach ($matches[0] as $n => $link) {
            $new_link = preg_replace('/>/', ' data-wpel-link="exclude">', $link);
            $text = preg_replace('/' . preg_quote($matches[0][$n], '/') . '/', $new_link, $text);
        }
    
        return $text;
    }
    add_filter('the_content', 'bem_crawl_content');

    Thank you!

The topic ‘Very Useful’ is closed to new replies.