Description: You receive a warning message on your browser that says something like:
Warning: Cannot modify header information – headers already sent by
Why is this happening? According to wordpress codex, this happens when there are spaces, new lines, or other garbage before an opening or after a closing php tag, which usually in wp-config.php.
How to solve it? Open the wp-config.php using notepad or BBedit or any plain text editor. You can also use code editor like dreamweaver and other similar software.
Go to the first character or the first line of the code. Make sure that there are no spaces BEFORE the first character <. Otherwise, delete the empty spaces using “backspace” or “Delete” from your keyboard. Also make sure that there are no spaces between the opening tags <, ? and php.
Now go to the last character or last line of code. Make sure that there are no empty spaces AFTER the last character >. Otherwise, (again) delete the empty spaces using “backspace” or “Delete” from your keyboard. Also make sure that there are no spaces between the closing tags ? and >.
It is still not working? I also encountered this problem. If editing the wp-config.php does not work. Open your function.php and do the same solution as above.
Further Troubleshooting. If all of the solutions still does not work. Determine which file is having the error. For example it says:
Warning: Cannot modify header information – headers already sent by (output started at /path/wp-admin/admin-header.php:8) in /path/wp-admin/post.php on line 569. Then it clearly states that there is some problem on admin-header.php in line #8 which affects the line #569 of post.php. Therefore, I suggest you open the admin-header.php and check for some whitespaces or other garbages and do the same solution mentioned above.