WordPress Error: Warning: Cannot modify header information

wordpress

Yesterday I was helping a reader solving his WordPress error, so I thought I might as well write an entry, just in case we all encounter this in the future. If you ever run across this error (or warning) in your WordPress with the message saying:

Warning: Cannot modify header information – headers already sent by (output started at //home/htdocs/wordpress/wp-config.php:1) in /home/htdocs/wordpress/wp-login.php on line 12

or something similar, chances are you have messed up your wp-config.php leaving some unnecessary spaces inside.

Solution

  1. Download your wp-config.php down via FTP (Edit directly if you have SSH access)
  2. Open wp-config with your favourite editor, and remove all spaces before "<?php" and after "?>"

    wordpress error

    wordpress error

  3. Upload and replace.

You are adviced to make backup of any files you edited.

Author:

Founder and Chief Editor of Hongkiat.com, a designer, developer and hardcore fan of Apple. Follow him on Twitter, or befriend him on Facebook.

Advertisement