Headers already sent – WordPress core

I’m getting an error on my site regarding “headers already sent”:

Warning: Cannot modify header information – headers already sent by (output started at ………/wp-admin/menu-header.php:161) in ……/wp-includes/pluggable.php on line 881

I read the WordPress FAQ that discusses this, but – as you can see – this error is caused by the WordPress core (and not even at the end of a file).

Interestingly, I don’t get this error on my local machine. Only on my server.

What can I do about this?

I’m running WordPress 3.4.2

1 Answer
1

WordPress provides a way to prevent the header HTML from being rendered, by appending &noheader=true to the url.

That will cause the header HTML to wait for you to call it manually, so that you can do a redirect before that.

To later render the header HTML from your page, you’ll have to use this:

if ( isset($_GET['noheader']) ) {
    require_once(ABSPATH . 'wp-admin/admin-header.php');
}

For more information, read this article: WordPress and wp_redirect() function problem.

Leave a Comment