Title: Cannot modify header information error &#8211; functions.php
Last modified: August 20, 2016

---

# Cannot modify header information error – functions.php

 *  Resolved [carloravelli](https://wordpress.org/support/users/carloravelli/)
 * (@carloravelli)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/)
 * I am getting a cannot modify header information error on my functions.php, more
   specifically a file it’s including (which is not the issue).
 * `Warning: Cannot modify header information - headers already sent by (output 
   started at /home/yc/domains/yc.keytoe.nl/public_html/wp-content/themes/yourconnector/
   inc/metaboxes.php:6) in /home/yc/domains/yc.keytoe.nl/public_html/wp-includes/
   pluggable.php on line 881`
 * Metaboxes.php is my metabox file, where I have all my code for just that. Everything
   works fine except when trying to save anything, I get a blank page. The save 
   is succesful but I have to manually go back to wp-admin and that obviously isn’t
   how it’s supposed to work.
 * My metaboxes.php code is:
 *     ```
       <?
       // --- METABOX CREATE --- //
       add_action('admin_init', 'page_spec_meta');
   
       function page_spec_meta(){
       (this is line 6)	$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ; $template_file = get_post_meta($post_id,'_wp_page_template',TRUE);
        if ($template_file == 'talenten.php')
           {
       		add_meta_box("career-meta", "Career", "career_meta", "page", "normal", "high");
               add_meta_box("business-meta", "Business", "business_meta", "page", "normal", "high");
               add_meta_box("inspired-meta", "inspired", "inspired_meta", "page", "normal", "high");
               add_meta_box("network-meta", "Network", "network_meta", "page", "normal", "high");
               add_meta_box("future-meta", "Future", "future_meta", "page", "normal", "high");
           }
       	if ($template_file == 'bedrijven.php')
           {
       		add_meta_box("unique-meta", "Unique", "unique_meta", "page", "normal", "high");
               add_meta_box("providing-meta", "Providing", "providing_meta", "page", "normal", "high");
               add_meta_box("inspired-meta", "inspired", "inspired_meta", "page", "normal", "high");
               add_meta_box("network-meta", "Network", "network_meta", "page", "normal", "high");
               add_meta_box("future-meta", "Future", "future_meta", "page", "normal", "high");
           }
       }
   
       ....rest of the page
       ?>
       ```
   
 * I can’t really figure out what’s wrong. It can’t be whitespaces, checked all 
   that.

Viewing 15 replies - 1 through 15 (of 19 total)

1 [2](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/page/2/?output_format=md&replies=12)
[→](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/page/2/?output_format=md&replies=12)

 *  [Shane Gowland](https://wordpress.org/support/users/thewebatom/)
 * (@thewebatom)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/#post-3154519)
 * 99% of the time this error is caused by whitespace in functions.php.
 * Try removing the closing `?>` from both metaboxes.php and functions.php.
 *  Thread Starter [carloravelli](https://wordpress.org/support/users/carloravelli/)
 * (@carloravelli)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/#post-3154525)
 * Doesn’t do the trick. Someone else told me it could be that add_meta_box is outputting
   html is messing it up, could that be it?
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/#post-3154526)
 * Is `(this is line 6)` in your actual code?
 *  Thread Starter [carloravelli](https://wordpress.org/support/users/carloravelli/)
 * (@carloravelli)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/#post-3154527)
 * Nope, just a note to show where the 6th line is (that’s where the error starts).
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/#post-3154530)
 * It’s almost certainly your theme but that’s easy to confirm.
 * Try switching to to the Twenty Eleven by using FTP or other file management and
   rename `themes/yourconnector` to `themes/yourconnector-old`. Then visit `http://
   your-url-here/wp-admin/themes.php` page and you should be switched to the Twenty
   Eleven theme.
 * > Doesn’t do the trick. Someone else told me it could be that add_meta_box is
   > outputting html is messing it up, could that be it?
 * Shouldn’t be, that would cause a different error I think. Can you use [pastebin.com](http://pastebin.com/)
   and post the link to that for that entire file? Line numbers work there and the
   forum here does not handle code that well.
 * It could be your `functions.php` or it could also be your `wp-config.php` file
   too even though it’s not given you grief before.
 * [http://codex.wordpress.org/FAQ_Troubleshooting#How_do_I_solve_the_Headers_already_sent_warning_problem.3F](http://codex.wordpress.org/FAQ_Troubleshooting#How_do_I_solve_the_Headers_already_sent_warning_problem.3F)
 *  Thread Starter [carloravelli](https://wordpress.org/support/users/carloravelli/)
 * (@carloravelli)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/#post-3154536)
 * [http://pastebin.com/52UZYqaY](http://pastebin.com/52UZYqaY)
 * Not sure what switching themes is going to do, but I’ll go ahead and do that.
 * And I already checked that link before, whitespaces are not the problem, I’m 
   pretty sure of that. wp-config is clean as it came in the package, only thing
   I did was turn debug on.
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/#post-3154537)
 * > Everything works fine except when trying to save anything
 * Do you print or echo something out in your metabox code when saving a post?
 * example from: [http://codex.wordpress.org/Function_Reference/add_meta_box#Example](http://codex.wordpress.org/Function_Reference/add_meta_box#Example)
 *     ```
       /* Do something with the data entered */
       add_action( 'save_post', 'myplugin_save_postdata' );
       ```
   
 * Can you show us the code where you save your metabox data?
 *  Thread Starter [carloravelli](https://wordpress.org/support/users/carloravelli/)
 * (@carloravelli)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/#post-3154538)
 * > Can you show us the code where you save your metabox date?
 * Check my previous comment, that’s the metaboxes.php file that has everything.
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/#post-3154541)
 * > Not sure what switching themes is going to do, but I’ll go ahead and do that.
 * It’s just part of the check list and will help confirm where the problem _may_
   be.
 *  Thread Starter [carloravelli](https://wordpress.org/support/users/carloravelli/)
 * (@carloravelli)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/#post-3154543)
 * A succesful save with twentyeleven, so that’s my theme’s issue right?
    Weird 
   thing is it this issue came out of nowhere.
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/#post-3154545)
 * I just checked, this is a duplicate post you’ve created.
 * [http://wordpress.org/support/topic/unusual-issues-with-both-wordpress-and-my-theme-wp-admin-related?replies=2](http://wordpress.org/support/topic/unusual-issues-with-both-wordpress-and-my-theme-wp-admin-related?replies=2)
 * Don’t do that, it really makes it hard for us to support you. If it weren’t for
   the fact that you’ve 2 moderators helping you I’d normally close the newer topic
   down with a note.
 * I’ll let it go this time. 😉
 * > A succesful save with twentyeleven, so that’s my theme’s issue right?
 * It’s _probably_ is a theme issue but still could be something else. Have you 
   updated anything lately?
 * Let’s see if it can be narrowed down some more. While the Twenty Eleven theme
   is active, deactivate all of your plugins and then switch back to that theme.
 * Did the error come back after all of the plugins were deactivated?
 *  Thread Starter [carloravelli](https://wordpress.org/support/users/carloravelli/)
 * (@carloravelli)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/#post-3154547)
 * Sorry, but getting no answer and not being able to find anything else in on the
   internet being similar to this gets stressful. I’ll stick to the rules from now
   on 🙂
 * Only active plugin was Contact Form 7, did as you said and still the same issue.
   
   Regarding updates, only things I did were replace wp-admin and wp-includes (only
   those folders, not the config files and such) and upload and remove tinymce.
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/#post-3154551)
 * Theme issue or `wp-config.php` but what’s changed…?
 * Which theme are you using? If you have backups (…you do have backups right…?)
   then save your current theme and see if uploading a fresh copy see if that can
   narrow it down even more.
 *  Thread Starter [carloravelli](https://wordpress.org/support/users/carloravelli/)
 * (@carloravelli)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/#post-3154554)
 * I’m using a custom theme made by me and 2 other front-end developers. Everything
   made from the ground up basically.
 * Back-ups are made when the website is ready to go live so nope… none yet.
 * I keep thinking it’s got to do with the metaboxes file, because I really didn’t
   make any other changes, certainly nothing to do with php. I did edit the admin-
   header.php file but then again I completely replaced wp-admin.
 * If you really need to I could post a link to the development url of the site,
   not sure if that would help.
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/#post-3154559)
 * > Warning: Cannot modify header information – headers already sent by (output
   > started at /home/yc/domains/yc.keytoe.nl/public_html/wp-content/themes/yourconnector/
   > inc/metaboxes.php:6) in /home/yc/domains/yc.keytoe.nl/public_html/wp-includes/
   > pluggable.php on line 881
 * Is that the only error?

Viewing 15 replies - 1 through 15 (of 19 total)

1 [2](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/page/2/?output_format=md&replies=12)
[→](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/page/2/?output_format=md&replies=12)

The topic ‘Cannot modify header information error – functions.php’ is closed to 
new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 19 replies
 * 5 participants
 * Last reply from: [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * Last activity: [13 years, 7 months ago](https://wordpress.org/support/topic/cannot-modify-header-information-error-functionsphp/page/2/#post-3154563)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
