Support » Fixing WordPress » link opens in a new folder

  • Hi I’d like to know how to set this function in every link in my blog.
    When the users click on a link, the link opens in a new page.
    I’ cannot find the way to do it!
    please help thank you so much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • just add in function.php , this will apply to all link in site , if you want to apply this one specific page you can use is_page(‘blog’) inside function like below
    Specific page
    Add in function.php

    function autoblank($text) {
        if(is_page('blog')){
    	$return = str_replace('<a', '<a target="_blank"', $text);
    	return $return;
    }
    }
    add_filter('the_content', 'autoblank');

    or
    To all links in site:
    Add in function.php

    function autoblank($text) {
    	$return = str_replace('<a', '<a target="_blank"', $text);
    	return $return;
    }
    add_filter('the_content', 'autoblank');

    wow thank you so much! codes… do you know if there’s any plugin that does it?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘link opens in a new folder’ is closed to new replies.