Support » Plugins » links in posts and pages editor to add target=”_blank” by default?

  • Resolved datahound


    Brand new to WP what a treat!

    I have some knowlege of PHP, I would like to know where I can edit the line that wraps the a href code around the link when you create a link in post or page, so it can include target=”_blank” as standard.

    Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • If you want all links to open in a new window, you’d like to set _blank as the default target. You can do this by inserting the following in the header section header.php:
    <base target="_blank" />

    It is also possible that you can add target="_blank" in your post using the html editor. I haven’t tested it and it is quite possible that it will be filtered out, as it is not part of xhtml.

    I searched before I posted and that was a solution offered (<base target=”_blank” />) in an earlier post, but that is not what I want to achieve.

    At the moment I am editing manually in the html editor and adding the target=”_blank” text in every link. It does not get filtered out. I know purists might find it vulgar but I prefer the new window.


    I’ve been using this plugin Zap New Window. Just install and activate the plugin, it will add some javascript to the head of each page and force all externals links (ie: outside of your domain) to open in a new window. It uses javascript, so visitors (I assume) would have to have it enabled for it to work.

    Good luck,

    Thanks very much Niziol, worked a treat.



    thanks petit, that was very helpful.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘links in posts and pages editor to add target=”_blank” by default?’ is closed to new replies.