warning: cannot modify header information
Everything with your WordPress blog is working great, but suddenly the entire site stops working and gives you an error like the following:
Warning: Cannot modify header information - headers already sent by (output started at /home/site/public_html/wp-content/themes/my-theme/functions.php:49) in /home/site/public_html/wp-includes/pluggable.php on line 770
Maybe you just made a change to your code. Maybe you just changed something in your theme. Maybe you just touched the wp-config.php file. Whatever you did, it killed your site and you can’t find any errors in your code. What is going on?
The problem is a blank line in the file mentioned in the error at the line number specified. Keep in mind that the first file and location listed is where the error is, not the second file and location. So, going by my previous example, the problem is a blank line at line 49 of the current theme’s function.php file.
If you were to have the following code in your functions.php file, you will get this error:
<?php example_function(); ?> <?php example_function(); ?>
To fix the problem, you would remove the blank line:
<?php example_function(); ?> <?php example_function(); ?>
You could also group the PHP code together such as the following:
<?php example_function(); example_function(); ?>
Happy coding. ![]()