title: How to make a redirection link open in new tab
body: <p>I am using this following code to make a post redirect to a custom URL in WordPress:</p>
  
  <pre><code>add_action ('template_redirect', 'custom_redirect');
  function custom_redirect() {
  global $post;
    if( is_single() ){
      $external_link =  get_post_meta( $post-&gt;ID, 'external_link', true );
      if($external_link) {    
         wp_redirect( $external_link );
         exit;
      }
    }
  }
  </code></pre>
  
  <p>But my site breaks when I add <strong>target="_blank"</strong> to the 5th line. I am adding it like this:</p>
  
  <pre><code>$external_link =  get_post_meta( $post-&gt;ID, 'external_link', true, target="_blank", );
  </code></pre>
  
  <p>But it is now working. </p>
  
  <p>I just want the external links to open in new tab.</p>
  
  <p>What I am doing wrong?</p>