Knowledgebase

Cannot modify header information in wp-config or functions Print

  • wordpress, php, troubleshooting, backup, restore, themes, woocommerce, errors
  • 0

Whitespace before or after the PHP tags.

WHAT IT MEANS

Output was sent before WordPress could set headers. Almost always a stray space or blank line.

WHERE TO LOOK

The error names the file that produced output. That file is the problem, not the one attempting the header.

The usual culprits are wp-config.php and a theme's functions.php.

THE FIX

Open the named file.

Check the very beginning: there must be nothing before the opening tag. Not a space, not a blank line.

Check the very end: remove the closing tag entirely. It is not required in a pure PHP file, and removing it prevents trailing whitespace causing this.

WHY IT HAPPENS

An editor adding a newline on save Text pasted with a leading space A byte order mark added invisibly by some editors

IF YOU JUST EDITED THE FILE

Restore your backup copy and edit again more carefully.

CHECKING FOR INVISIBLE CHARACTERS

Some editors show them. Alternatively, retype the first and last lines rather than trying to spot the problem.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot