Troubleshooting guide · wordpress · Published 2026-08-15 · 3 min read

WordPress and PHP "headers already sent" white-screen fix

Fix the PHP headers already sent warning in WordPress that causes blank pages, by locating the output that precedes the header call.

The message "Cannot modify header information - headers already sent" appears in WordPress when PHP has already written some output before a header was due, and that earlier output blocks the header of the HTTP response. In its mild form it is a warning on screen; in its severe form, when the layout or timing breaks, it shows as a white screen. The cause is almost always a small, invisible piece of text emitted before PHP intended to send a header.

What the warning means

PHP must send headers such as Location: and the response's Set-Cookie before it sends the body. Once even one character of the body has been output, headers can no longer be written. When code tries to set a header after output has started, PHP emits the "headers already sent" warning and skips that header.

That skipped header is what breaks a site. A redirect that never fires, a session that cannot start, or an HTTP header missing its content type can each surface as a blank page or a broken flow rather than a clear error.

The stray output almost always comes from one of three places:

Find the stray output

The warning itself names the file and line where output started, so read the exact file and line first.

The reliable way to confirm the remedy is a text editor that shows invisible characters, or a byte-oriented tool, so you clear the exact whitespace the file actually contains.

Prevent and confirm

Confirm the fix by reloading the page and checking that the warning is gone and headers send normally. If a caching layer sat in front of the error, clear the page cache so you are testing the origin and not a stale copy.

Prevent a repeat: save PHP files with no byte order mark, with no blank line above the opening tag, and remove the trailing closing tag when a file is pure PHP, which eliminates the opportunity for a stray newline at the end. See white screen of death and PHP fatal error taking a site down for the related blank-page failures and their proof the change reached the origin.

Need a website built, fixed, optimised, migrated or replaced?

This technical resource is written by CSMBAC, a small design and development studio. If you would rather hand the problem to a professional, the website service page explains how we build enquiry-ready websites.

Explore website services