title: Log out Wordpress and redirect to different URL
body: <p>I have a sign out on my site to log out of Wordpress</p>
  
  <p>When logged out I would like to redirect uses to a different URL.</p>
  
  <p>I'm using this in the functions.php</p>
  
  <pre><code>    add_action(' wp_logout ',' auto_redirect_external_after_logout ');
      function auto_redirect_external_after_logout(){
        wp_redirect( ' http://redirect-url ' );
        exit();
      }
  </code></pre>
  
  <p>and this in the header</p>
  
  <pre><code>    &lt;li class="signOut"&gt;&lt;?php wp_logout(); ?&gt;&lt;/li&gt;
  </code></pre>
  
  <p>When I run this I get a long list of errors in the page</p>
  
  <pre><code>    Warning: Cannot modify header information - headers already sent by
  </code></pre>