Open Link In New Tab WordPress Automatically

Add Tool

Open Link In New Tab WordPress Automatically


Open Link In New Tab WordPress Automatically

Are you thinking about how to open link in new tab WordPress automatically? Don't think about it. I have found many websites which post or article links Open link in new tab or new window. Generally you will find it in software download website, movie download, songs download, video download etc. website. You will see when you click on download link or any link may be internal or external all links will Open in new tab or new window.

See Also:  Add extra buttons to WordPress Visual Editor

You can do this manually by adding target="blank" in your link code. We know main syntax of link is <a href="#">Link Title Here</a> but using this codes your link will open at same tab or same window and adding target="_blank" in the link code your link will Open link in new tab WordPress or new window. Then full code will like

<a target="_blank" href="http://1stwebsuite.com">Link Title Here</a>

You can add target="blank" in all links dynamically in WordPress platform by using some php snippets in your functions.php file. Which will transform all links to target="blank" links.

Now simply add the below WordPress snippets in your theme's functions.php file

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

Now save and browse your site to check that your all content or post links is opening at new tab or new window

Source


Tags: javascript open link in new tab, chrome open link in new tab, open link in new tab html, open link in new tab, html open link in new tab
Payza

About Masum Billah

Open Link In New Tab WordPress Automatically Hi I am Md. Masum Billah Contributor of this website. I always like to share various things with other. In this website I am sharing web design related tips and tricks, necessary web development tools, source codes for beginner and advance web developer.


SIGN UP TO GET UPDATE TO YOUR INBOX




Discuss about: Open Link In New Tab WordPress Automatically


adf.ly