0

I've checked the offical "How do I solve the Headers already sent warning problem?" and have resolved a whitespace problem, changing:

function mhm_footerheader_position ()

to

function mhm_footerheader_position(), but at /wp-login.php, we still receive the error:

Warning: Cannot modify header information – headers already sent by (output started at /home/username/public_html/wp-content/themes/genesis-sample/mhm-functions.php:281) in /home/username/public_html/wp-login.php on line 394

Here is mhm-functions.php from line 280:

function mhm_footerheader_position() {
    echo '<div id="footer-header"><div class="wrap">';
    genesis_widget_area('footer-header');
    echo '</div></div>';
}

add_action ('widgets_init','mhm_footerheader_position');

Help appreciated.

  • I'm sure there is a plugin, function or php file adding space or characters before the header. This happened to me too. Some will add hidden characters that you can't see without a text editor that can show all characters. Try disabling every plugin and them enable them 1 by 1 to see which one is causing a problem. – Jack Johansson Feb 16 '17 at 8:27
1

First of all, you misunderstood "How do I solve the Headers already sent warning problem?"

As you said, you've changed:

function mhm_footerheader_position ()

to:

function mhm_footerheader_position()

The only difference I see is the space between mhm_footerheader_position and (). The whitespace problem in header already sent error, isn't about the space between function_name and (). It's about space that gets into the output before any HTTP header is sent.

Secondly, you don't want to output anything in widgets_init action, this the the wrong place for any output. The error you are getting is because you are giving output in widgets_init action and in wp-login.php HTTP header is being sent after this action hook.

I can't say exactly where you want to output the footer-header widget area, it depends on your theme. However, the following CODE will output it in the footer and solve your Error:

    function mhm_footerheader_position () {
        echo '<div id="footer-header"><div class="wrap">';
        genesis_widget_area('footer-header');
        echo '</div></div>';
    }

    add_action ('wp_footer','mhm_footerheader_position');

You may read this to understand the Hearer Already Send Error better.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.