I have a problem with wordpress and the headers.php file inside a theme I am creating. I get the “Headers already sent” error.

I know there are a stack of other SO posts on here about this. None of the solutions have worked for me including

  • Remove all whitespace before and after the <?php
  • Check for a BOM (nothing in notepad)
  • Remove the trailing ?> tag (which worked almost [Now I only get errors when posting data] instead of every page).

    __( ‘Application Menu’, ‘MetroUiCss’ ),’footer-menu’ => __( ‘Footer Menu’, ‘MetroUiCss’ )));
    }
    }
    add_action( ‘after_setup_theme’, ‘register_my_menus’ );

And the error message is

Warning: Cannot modify header information – headers already sent by (output started at /sitepath/wp-content/themes/MetroUiCss/functions.php:1) in /sitepath/wp-includes/pluggable.php on line 1179

Read more here: WordPress headers.php Headers already sent


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: