This warning usually shows up at the top of the login page, in wp-admin after you save something, or on a white screen right after you edited wp-config.php or functions.php:
Warning: Cannot modify header information - headers already sent by (output started at /home/user/public_html/wp-config.php:34) in /home/user/public_html/wp-includes/pluggable.php on line 1450
It often comes with side effects. You can’t log in, redirects don’t happen, or the login form says Cookies are blocked due to unexpected output. All of them have the same cause: something printed output before WordPress could send its HTTP headers.
Once you know which file to open, the fix usually takes a minute. The warning tells you which file.
Read the error: only the first file matters
The message names two files. The one after output started at is the cause. The one after in (often pluggable.php, wp-login.php or class-wp-hook.php) is only the victim, the place where WordPress tried to send a header and found it was too late.
So in the example above, the problem is line 34 of wp-config.php. Don’t touch core files in wp-includes. Editing them won’t fix this.
Here is why it happens. PHP can only send headers (cookies, redirects, content type) before the first byte of the page body goes out. The PHP manual for header() says headers must be sent before any actual output, and that includes blank lines in a file. A single space before <?php or a newline after ?> counts as output.
Step 1. Back up the file named in the error
Copy the file before you edit anything. Over SSH:
cp wp-config.php wp-config.php.bak
If you only have FTP or a file manager, download a copy to your computer first. If you have a backup of that file from before the problem started, restoring it is the fastest fix. The WordPress.org troubleshooting FAQ recommends the same, or a fresh copy from a WordPress download if it’s a core file.
Step 2. Remove whitespace before <?php and after ?>
Open the file in a plain text editor (not Word, not a rich text editor) and check two places.
The very first characters of the file must be <?php. No empty line, no space, nothing before it.
Then go to the end of the file. If it ends with a closing ?> tag, delete everything after it, including empty lines. Better still, delete the ?> itself. The PHP manual on PHP tags recommends leaving out the closing tag in files that end with PHP code, for exactly this reason.
To see what’s really at the end of a file over SSH, print the last bytes:
tail -c 32 wp-config.php | od -c
od -c shows each character separately, so look for the ? and > pair. Any \n, \r or spaces after it are the stray output. If the file ends with plain PHP code and no closing tag, a trailing newline is harmless.
💡 If you pasted a snippet into functions.php, check that you didn’t paste an extra ?> and <?php pair with blank lines between them. Those blank lines are output too.
Step 3. Remove the UTF-8 BOM
If the file looks clean but the error still points to line 1, the file is probably saved as UTF-8 with BOM. The BOM is three invisible bytes at the start of the file, and PHP sends them to the browser as output.
Check the first three bytes:
head -c 3 wp-config.php | od -An -tx1
If you see ef bb bf, the file has a BOM. If you see 3c 3f 70 (that’s <?p), it doesn’t. Remove the BOM with GNU sed:
sed -i '1s/^\xEF\xBB\xBF//' wp-config.php
To find every PHP file with a BOM in your themes and plugins, run this from the WordPress root. It helps when the error points to a file you never edited:
find wp-content -name '*.php' -exec sh -c 'head -c 3 "$1" | od -An -tx1 | grep -q "ef bb bf" && echo "$1"' _ {} \;
No output means no PHP file under wp-content starts with a BOM. In a desktop editor, save the file with plain UTF-8 encoding. In Notepad++ that’s Encoding, then UTF-8, not UTF-8-BOM.
When the output is a PHP notice, not whitespace
Sometimes the line after output started at isn’t blank at all. It points into a plugin file, and above the headers warning there’s another message, such as a Deprecated or Warning line. That first message is the output. It was printed to the page, and every header after it fails.
This happens a lot after a PHP upgrade, when older plugins start throwing deprecation notices on a site that prints errors to the screen. The real fix is updating or replacing the plugin. Until then, log the notices instead of printing them. Add this to wp-config.php above the That’s all, stop editing! line:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

The notices now go to wp-content/debug.log and stop breaking the headers. If that log never appears, see debug.log not created in WordPress. For more on the debug constants, I have a separate post on how to properly debug in WordPress.
💡 Set WP_DEBUG back to false once you’ve found the plugin. On a busy site, a growing debug.log can fill the disk.
When a plugin or theme prints output on purpose
If the file is a plugin or theme and there’s no notice, look at that exact line. Leftover echo, print_r() or var_dump() debugging, or HTML outside a function in functions.php, all send output too early.
If it locks you out of wp-admin, deactivate the plugin with WP-CLI without loading the broken code:
wp plugin deactivate plugin-folder-name --skip-plugins --skip-themes
Use the folder name from the path in the error (the part after wp-content/plugins/). WP-CLI should confirm that the plugin was deactivated. For a theme, run wp theme list to see what’s installed and switch to a default theme with wp theme activate and its name. If the site shows a full fatal error instead of this warning, follow There has been a critical error on this website instead.
Why I don’t use ob_start() as the fix
You’ll find advice to wrap things in ob_start() or turn on output_buffering in php.ini. The PHP manual confirms that output buffering lets you send headers after output, so yes, the warning goes away.
But the stray output is still there. A BOM or a blank line ends up in your HTML, RSS feed, REST API responses and AJAX replies, where it can break JSON parsing. Removing the bytes fixes the cause. Buffering only hides it.
To keep it from coming back, don’t end PHP-only files with ?>, set your editor to save as UTF-8 without BOM, and keep WP_DEBUG_DISPLAY off on live sites. The WordPress PHP coding standards also prefer omitting the closing tag.
TL;DR: Open the file named after “output started at”, not the one after “in”. Delete anything before <?php, delete the closing ?> and anything after it, and save as UTF-8 without BOM. If the output is a PHP notice from a plugin, log it with WP_DEBUG_DISPLAY off and update that plugin.

