Posted By

benjaminpearson on 01/05/10


Tagged

rss wordpress xml


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


Wordpress RSS XML Space Error


 / Published in: XML
 

URL: http://www.w3it.org/blog/wordpress-feed-error-output-solution-how-to/

Allows you to remove the whitespace that can appear before the xml tag in wordpress files such as wp-includes/feed-rss2.php

  1. // find these lines in the php file (ie, feed-rss2.php)
  2. header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
  3. $more = 1;
  4.  
  5. // immediately add these 3 lines after
  6. $out = ob_get_contents();
  7. $out = str_replace(array("\n", "\r", "\t", " "), "", $input);
  8. ob_end_clean();

Report this snippet  

You need to login to post a comment.