• Resolved weasello

    (@weasello)


    I was having trouble with my RSS feeds, so I peppered the WP source files with “echo” commands and found out where my problem lay.

    RSS requires the first character to be <?xml , but there are two characters of whitespace before the string, which breaks most readers.

    I eventually tracked it down to WP-SETTINGS.PHP:
    LINE 133:

    foreach ($current_plugins as $plugin) {
    if ('' != $plugin && file_exists(ABSPATH . 'wp-content/plugins/' . $plugin)) {
    include_once(ABSPATH . 'wp-content/plugins/' . $plugin);
    echo('-'); }
    }

    I refresh my RSS after adding the above echo command, and the top of my RSS feed is


    ------- ---- -----<?xml

    Ah ha! Two of my plugins are adding whitespace.

    I then discover the two culprits are *my* plugins. Very short, they just add some functions I call from my pages directly. At the very start of my plugin, I add “echo 1” and at the <strongvery end I put “echo 2”:


    echo('2');
    ?>

    My RSS output then displays:


    --------12 ---12 ----<?xml

    Now this is troubling, and the crux of my problem. Somewhere after the end of my plugin file, and before the WHILE loop is recalled, it’s inserting the space!

    I’m pulling my hair out, what could this be?!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘My plugins are adding whitespace’ is closed to new replies.