WordPress “Cannot Modify Header Information – Headers Already Sent” Fix (2026)
“Cannot modify header information – headers already sent” means something was sent to the browser before WordPress finished setting headers. The handbook says it usually means spaces or characters before an opening PHP tag or after a closing tag. Find the file named in the warning and remove them.
This warning often appears after you edited wp-config.php, functions.php or a plugin file in a text editor.
What the Warning Means
PHP must send headers before any page content. If even one space or blank line is output earlier, the headers are already gone and PHP shows this warning. The WordPress handbook says it usually means you have spaces or characters before the opening tags or after the closing tags of a PHP file. It also says that if you see the warning right after installing WordPress, you may have introduced a syntax error into wp-config.php.
Fix 1: Read the Warning Carefully
The full message usually names two files. PHP shows where the output started and where the header was attempted. The first file, where the output started, is the one to open. The line number helps you find the stray space.
Fix 2: Remove Spaces and Characters Around PHP Tags
Open the file in a plain text editor. Make sure nothing, not even a blank line or a space, comes before the opening PHP tag. At the end of the file, remove anything after the closing tag. Many developers leave the closing tag out of pure PHP files for this reason. Save the file without a byte order mark if your editor offers that option.
Fix 3: Check wp-config.php
If the warning began right after you changed wp-config.php or installed WordPress, check that file for a syntax error. Compare it with the original wp-config-sample.php. For help with syntax mistakes, see our parse error guide.
Fix 4: Deactivate the Plugin or Theme
If the first file named is inside a plugin or theme, deactivate it by renaming its folder through FTP, as in our critical error guide, and contact its author with the exact warning.
How to Prevent It
- Edit PHP files in a code editor, not a word processor.
- Do not leave blank lines before the opening PHP tag.
- Test edits on a staging copy first.
Verified Facts and Sources
The cause of the warning and the wp-config.php note come from the handbook page on common errors. The advice on reading the two file names reflects how PHP reports this warning. We did not reproduce it on a test site.
Frequently Asked Questions
What causes the headers already sent warning?
Output was sent before the headers, usually from spaces or characters outside the PHP tags in a file.
Which file should I fix?
The one where the output started, as named in the warning.
Does it damage my site?
It breaks the affected page or function, such as login, but it does not delete content.
Can wp-config.php cause it?
Yes, especially right after installing WordPress or editing the file, according to the handbook.
Updated December 2, 2026.