How to fix XML parsing feed error in wordpress

When I started my blog, I found my RSS feed was not functional and was giving some error like “XML Parsing Error: XML or text declaration not at start of entity”. It was kind of invalid XML feed and the solution was to remove the white spaces before XML declaration.

I went to feed-rss2.php, feed-rss.php and removed the spaced but it never worked. There was no proper solution in google search and then I found a website w3it which have a good tip to solve this problem. It was about adding few lines of code in feed-rss2.php and/or feed-rss2-comments.php. Here is an excerpts from the site:

What we need, is to add a little tip in specific files where wordpress feeds are made up before to be outputted to the browser on request.

So, we go to fix this by opening the follow file, if the feed we want is RSS2 in wordpress (we will see all any other after in any case):

wp-includes/feed-rss2.php

open it with a text editor and read on the very top section, the following code:

header(‘Content-Type: text/xml; charset=’ . get_option(‘blog_charset’), true);

$more = 1;

To fix the feed on wordpress (but not only, it is obviously valid in, and for, any other feed or non feed contest where we can have the same necessity), add this tricky Php code immediately after:

$out = ob_get_contents();

$out = str_replace(array(“\n”, “\r”, “\t”, ” “), “”, $input);

ob_end_clean();

Do the same almost with the comment’s feed file: feed-rss2-comments.php

Save/replace the feed-rss2.php and the feed-rss2-comments.php files modified in this way and enjoy your re-enabled feeds!

And yesterday I faced the same problem once again and this tip did not work. And then I found wordpress plugin which does this job so smartly. This plugin is know is fix-rss-feed developed by flyaga.info. This wordpress plugin fixes this issue in no time.

I dont think I need to explain how it works but in case if you are new to wordpress, here are the steps. Download the plugin from the above link and install / activate it. Login to Admin control panel, under setting you can see fix rss feed link. Go to that link and press fix wordpress RSS feed button and you are done.

No related posts.

One Response to “How to fix XML parsing feed error in wordpress”

  1. I enjoyed the article and thanks respecting posting such valuable info emoluments of all of us to skim, I fit up it both valuable and communicative and I cheque to be aware of out it as over as I can.


Leave a Reply

Income Elite to make money online

Our Sponsors

Earn money writing

Our Sponsors

Categories

Archives

Invesp landing page optimization