Fixing the WordPress “Cannot Modify Header Information” Error

by Michael on October 19, 2013 · 1 comment

I recently started seeing a PHP-related error that kept popping up while clicking around in my WordPress dashboard. Whenever I’d toggle a plugin, change themes, try to preview a post, it would pop up. How very annoying.


The text of the error was:

Warning: Cannot modify header information - headers already sent by (output started at /home/financia/public_html/wordpress/wp-config.php:97) in /home/financia/public_html/wordpress/wp-includes/pluggable.php on line 875

So, naturally, I went and looked line 875 in pluggable.php but didn’t see any problems. Hmmm. Time to try other (possible) solutions.

I tried deactivating plugins. No effect. I switched themes. Nothing. I re-installed WordPress. The problem persisted.

I then contacted my host and they tried a number of things, including rolling PHP back to an earlier version. Nothing helped.

Then I popped into wp-config.php and saw an extraneous line of code from a caching plugin that I was no longer using.

define('WPCACHEHOME', '/home/mysite/public_html/wordpress/wp-content/plugins/wp-super-cache/' ); //Added by WP-Cache Manager

Surely that’s the problem. Right? Wrong. Deleting it didn’t resolve the error.

I then scrolled to the bottom of that file and saw two extra lines of whitespace after the closing ?> tag. Bingo. Deleting those fixed the problem.


{ 1 comment… read it below or add one }

todayshare.net March 18, 2016 at 9:10 am

Aw, this was an extremely good post. Taking a few minutes and actual effort
to produce a top notch article… but what can I say… I hesitate a
lot and don’t seem to get anything done.

Reply

Leave a Comment

Previous post:

Next post: