A common error in WordPress theme or plugin development is the dreaded “Cannot modify header information” – headers already sent” error message displayed on a white screen of death.
Often the issue references pluggable.php file error which is part of the WordPress core. As I am sure you are aware, WordPress is a powerful open source content management system. WordPress allows developers the ability to override certain core functions which are located within the pluggable.php file.
Below is an example of the common error, if it looks familiar, don’t panic, we will move swiftly onto common fixes.
Warning: Cannot modify header information – headers already sent by (output started at /home/username/website/wp-content/themes/mytheme/functions.php:99) in /home/username/website/wp-includes/pluggable.php on line 1179
Fixing pluggable.php File Error in WordPress
The error message contains vital information to fix the bug. The key information is contained within the first set of brackets, where the message displays “output started at …”. Here you will find the file which is most likely the culprit of the error. The file will be followed by a number, in this case, line 99, this relates to which line the error occurs within the file.
More often than not the error message is caused by a space following the closing PHP ?> tag. So be sure to check this first.
If the error message refers to a specific plugin directory, we would recommend deactivating the plugin and contacting the plugin developers to provide a suitable fix.
Very rarely will this error be caused by the pluggable.php file or any other core WP files & we DO NOT recommend editing these core files directly.
We hope this short blog post will assist you in fixing your WordPress headers already sent error.