简体   繁体   中英

Wordpress Feeds: PHP Warning Cannot modify header information - headers already sent

Every time a RSS feed (ie: (www.example.com/feed/) on my wordpress site is called I get a PHP E_Warning:

Cannot modify header information - headers already sent by (output started at /var/www/vhosts/(...)/httpdocs/wp-includes/functions.php:3464)

I did my research and most advice points towards blank spaces at the beginning and end of PHP files. But this is a wordpress core file.

ob_end_flush happens on line 3464:

function wp_ob_end_flush_all() {
    $levels = ob_get_level();
    for ($i=0; $i<$levels; $i++)
        ob_end_flush();
}

I did noticed that this functions.php did not have a closing ?> but given that it's a core wordpress file I would not question this too far :)

This error is comes because when you are using header function and php get output before that function then php show that warning message.

so check that you are not using "echo" or not call any function before the header function that gives output. if so please remove that.

There is a tip for remove that kind of error.

please remove all the blank lines and spaces before the file. and put

ob_start(); at the beginning of the file.

i hope will work for you.

Thanks!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM