Your pages open with a block of technical text such as Warning: Cannot modify header information - headers already sent or Deprecated: Creation of dynamic property, often with a file path from your server. Visitors read it as a broken or hacked site, it can push your layout down, and some of these messages also stop logins and forms from working. Below is a rebuilt example (not a real client), the two-minute check, and the fix for each cause.
Deprecated and Notice are harmless old-code messages that should never be shown to visitors. Warning means something did not run as intended. The path after in /.../wp-content/plugins/name/ or /themes/name/ tells you which plugin or theme sent it.wp-config.php (hosting File Manager or SFTP, in the folder that holds wp-admin) and look for WP_DEBUG. If it says true on your live site, that alone explains most cases (row 1).headers already sent, logins, redirects and form confirmations often fail too (row 3).| What you see | Why it happens | The fix |
|---|---|---|
Many Deprecated, Notice or Warning lines on every page | Debug mode was left on in wp-config.php (often after someone troubleshot the site), so WordPress prints every message to visitors | Keep the messages, but send them to a private log instead of the page. In wp-config.php, above the line that says "That's all, stop editing":define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ); @ini_set( 'display_errors', 0 );Or set WP_DEBUG to false once nothing needs investigating. Change the existing lines; do not add a second copy |
Deprecated: ... or Warning: Undefined array key appeared after your host upgraded PHP | An older plugin or theme was written for an earlier PHP version. Newer PHP reports code it is retiring | Update the plugin or theme named in the path. If it has had no update in a year or more, replace it with a maintained one. Do not move back to an old PHP version for long: it stops getting security fixes (see outdated PHP) |
Warning: Cannot modify header information - headers already sent by (output started at /.../file.php:NN) | Something printed text before WordPress sent the page headers. Usually a blank line or space before <?php or after a closing ?> in the file named after "output started at", often functions.php or wp-config.php edited by hand. It also stops logins and redirects | Open the file and line it names. Delete any blank line or space before the first <?php, and remove a closing ?> at the very end of the file (it is not needed). Save it as UTF-8 without BOM; some editors add an invisible mark that counts as output. If the file is a plugin's, update or replace the plugin |
Warnings show even though WP_DEBUG is false | The hosting account has PHP's display_errors switched on, so real warnings still reach the page | In your hosting panel's PHP settings (cPanel "MultiPHP INI Editor" or "Select PHP Version > Options"), turn display_errors off. Then fix the warning itself: it is still a problem, now just a quiet one |
Warning: include(...): Failed to open stream: No such file or directory | A plugin or theme update did not finish and left files missing, or a file was deleted | Reinstall that plugin or theme from Plugins > Add New or the theme's source (your settings are kept in the database). If the update failed halfway, see update failed |
| The messages appeared and the editor or a form now says "not a valid JSON response" | The warning text is printed inside data the page expected to be clean, so the browser cannot read it | Fix the warning with the rows above; then see "not a valid JSON response" if the editor still fails |
functions.php from the WordPress dashboard editor. One stray character there can take the whole site down (see critical error and syntax error).Turning debug display off takes a minute. Finding which plugin's code breaks on the new PHP version, replacing an abandoned plugin without losing its settings, or chasing a "headers already sent" that also broke logins is where most owners would rather have someone do it. If that is you, the box below is for that. Related: white screen, login keeps sending you back and outdated PHP version.