Is there a plugin that makes extnernal links open in new window, BUT

Is there a plugin that makes external links open in new window, BUT only on the pages or domains or links I specify?

Related posts

Leave a Reply

2 comments

  1. It’s not that hard – depending where you want it:

    <?php
    /* Plugin Name: (#21153) Open links in new window/tab */
    
    function wpse21153_open_new_window( $content )
    {
        // Add all your statements, when a link has to open in a new tab, here.
        if ( is_page() )
            return link_add_target( $content );
    
        return $content;
    }
    foreach( array( 'content', 'excerpt' ) as $location )
        add_action( "the_{$location}", 'wpse21153_open_new_window' );