Hui Wang

no Tech, no Info

Hope you find this simple and helpful.

Warning: Cannot modify header information – headers already sent

Posted on | July 1, 2009 | Views (1,367)

After adding several functions to the file functions.php, I get this warning when I try to install a plugin.

This is commonly known as the “whitespace problem”.

The error message typically looks something like

Warning: Cannot modify header information – headers already sent by (output started at /var/www/wordpress/wp-content/themes/yamidoo/functions.php:855) in /var/www/wordpress/wp-includes/pluggable.php on line 865

The solution is, obviously, to remove that whitespace from the file. Read the error message carefully. It says “output started at …” followed by a file name and a line number. That is the file (and line) that you need to edit. Ignore the second file name – that is only a file that included the file that has the whitespace. The first file is the one you have to edit, not the second one.

In my case, I removed the spaces between the end of the former file and codes added.

<?php } //end of the former file?>

hare are the whitespaces to be removed
<?php  //codes added ?>

Comments

Leave a Reply






  • About

    Hui WANGHi everyone, I'm Hui, a student originally from China, now studying at TELECOM SudParis in France. Hui-Wang.info is being used as a place to record my various adventures with technology.

  • Find Me On

  • Search