XML sitemap error for extra spaces

Add this code under wp theme -> functions.php

<?php
function xml_extra_space_fix($input) {
    $allowed = false;
    $found = false;
    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;
        }
    }
    if ($allowed || !$found) {
        return preg_replace("/\\A\\s*/m", "", $input);
    } else {
        return $input;
    }
}
ob_start("xml_extra_space_fix");
?>
8 responses... add one

“I was excited to discover this website. I wanted to thank you for your time for this particularly fantastic read!! I definitely enjoyed every part of it and i also have you saved as a favorite to see new things on your blog.”
נערות ליווי בחולון

Leave a Reply

Your email address will not be published. Required fields are marked *