Email Bag | How To Fix Your RSS Feed In WordPress

twit 820x444 Email Bag | How To Fix Your RSS Feed In WordPress

A few moments ago I discovered that my RSS feed was not working correctly on this website. Of course the first thing I did was start deactivating and deleting a few WordPress plugins assuming they were conflicting with my blog or re-writing code on the backend of my blog. I discovered UTF – 8 error message when I was updating my information with twitterfeed. I called my 24/7 host provider, Hostgator tech support department and they offered a solution and the RSS feed is now working fine.

I was getting a strange UTF – 8 message that was extremely ugly to look at and I am sure some of my readers felt the same way if they clicked the RSS feed for my WordPress located in the upper right hand corner of this blog.

Hostgator technical support provided me with an solution via email and it fixed my RSS feed. I hope it helps!

According to my host, a lot of folks who have WordPress have been contacting the host with the same error issue.

Plugins deleted: Maintenance Mode and Secure WordPress. They were doing something funky and conflicting with my other plugins. Maybe that is just my website but imma just saying.

<?php
/*


WordPress leading whitespace fix

================================ Ever got the infamous "xml declaration not at start of external entity" error instead of your RSS feed when using WordPress? Well, you're not alone. I've spent couple hours tracking down which of the active WordPress plugins/themes broke my RSS feed. When the same situation repeated again on a different blog, my patience ran out... and I wrote this script that takes care of the issue once and for all. If you suffer with the same problem, download the plaintext version and follow install instructions to free yourself from the whitespace tyranny. ;) Download -------- Plaintext version: http://wejn.org/stuff/wejnswpwhitespacefix.php VIM Syntax colored: http://wejn.org/stuff/wejnswpwhitespacefix.php.html Requirements ------------ Works with PHP5 only, as the headers_list() function is missing in PHP4 which makes output Content-Type detection impossible. Installation ------------ Either use this as auto_prepend in your .htaccess: php_value "auto_prepend_file" /path/to/wejnswpwhitespacefix.php or include it as first thing in WordPress' index.php file even before that "short and sweet" line: <?php include("wejnswpwhitespacefix.php"); // Short and sweet define('WP_USE_THEMES', true); require('./wp-blog-header.php'); ?> Note: For the .htaccess way your AllowOverride must include "Options" (or better yet, be set to "All"); otherwise all you'll be getting is "Internal Server Error". Author: Wejn {wejn at box dot cz} License: GPL v2.0, no latter version(s) Version: 2.0 Changelog: - Added better mime-type detection - Now works even when C-T header not set - Changed intro text to better target keywords */ function ___wejns_wp_whitespace_fix($input) { /* valid content-type? */ $allowed = false; /* found content-type header? */ $found = false; /* we mangle the output if (and only if) output type is text/* */ foreach (headers_list() as $header) { if (preg_match("/^content-type:\\s+(text\\/|application\\/((xhtml|atom|rss)\\+xml|xml))/i", $header)) { $allowed = true; } if (preg_match("/^content-type:\\s+/i", $header)) { $found = true; } } /* do the actual work */ if ($allowed || !$found) { return preg_replace("/\\A\\s*/m", "", $input); } else { return $input; } } /* start output buffering using custom callback */ ob_start("___wejns_wp_whitespace_fix"); ?>
Thanks for visiting thephotographer4you®
Thephotographer4you®
pin it button Email Bag | How To Fix Your RSS Feed In WordPress
pixel Email Bag | How To Fix Your RSS Feed In WordPress

Related posts