title: How to add CORS support to Wordpress RSS2 feed?
body: <p>I am trying to add CORS (<a href="http://enable-cors.org/" rel="nofollow noreferrer">http://enable-cors.org/</a>) support to an RSS2 feed within a custom Wordpress theme. I have tried the following, all to no avail:</p>
  
  <ol>
  <li><p>Following the instructions on <a href="https://web.archive.org/web/20140314152828/http://bowdenweb.com:80/wp/2011/05/how-to-enable-cors-in-wordpress.html" rel="nofollow noreferrer">https://web.archive.org/web/20140314152828/http://bowdenweb.com:80/wp/2011/05/how-to-enable-cors-in-wordpress.html</a>, I attempted to modify the theme's header.php file and add the following code to it:</p>
  
  <p><code>header("Access-Control-Allow-Origin: *");</code></p>
  
  <p>This was successful in adding the CORS header to the Wordpress posts, but <em>not</em> to the RSS2 feed.</p></li>
  <li><p>Then, I attempted to use the "Plugin API / Action Reference", i.e. the <code>add_action</code> function (<a href="http://codex.wordpress.org/Plugin_API/Action_Reference" rel="nofollow noreferrer">http://codex.wordpress.org/Plugin_API/Action_Reference</a>).</p>
  
  <p>I added the following code to header.php:</p>
  
  <pre><code>function add_cors_headers()
  {
      header("Access-Control-Allow-Origin: *");
  }
  
  add_action('rss2_head','add_cors_headers');
  </code></pre></li>
  </ol>
  
  <p>Again, no success. Now I am at a dead end. Any ideas?</p>