Forums

[resolved] Another cannot modify header information error (9 posts)

  1. cw6365
    Member
    Posted 5 months ago #

    Another post on this subject, i've looked for white space in the main files but all seems to be ok. I have one error when adding a shortcode in the functions file, but i've never had the error in the header before and we're months into coding the site.

    Cannot modify header information - headers already sent by (output started at /var/www/vhosts/clienttestdomain.co.uk/httpdocs/wp-content/themes/kino/header.php:16) in /var/www/vhosts/clienttestdomain.co.uk/httpdocs/wp-includes/pluggable.php on line 754

    it was when i added a function if(wp_update_user(array('ID' => $currentUser->ID, 'user_pass' => $newpassword)))

    in this function, if i swap this out for a return statement eg $output .= "hello world"; it is fine?

    [Code moderated as per the Forum Rules. Please use the pastebin]

    The second error is in an admin plugin, this didn't happen on my local server

    Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/clienttestdomain.co.uk/httpdocs/wp-content/plugins/film_db/filmdb.php:81) in /var/www/vhosts/clienttestdomain.co.uk/httpdocs/wp-includes/pluggable.php on line 934

    I've checked the code and it still all works fine just shows this error, here is the method of the object that contains the code with line 81

    [Code moderated as per the Forum Rules. Please use the pastebin]

    I don't know where to start, what does this error even mean, what headers sent? Any help would be gladely received, i'm a broken man!!!

  2. cw6365
    Member
    Posted 5 months ago #

    ahh i've sorted the second one, it is the redirect, i forgot about adding it. Just the first one please

  3. esmi
    Theme Diva & Forum Moderator
    Posted 5 months ago #

  4. cw6365
    Member
    Posted 5 months ago #

    first port of call my friend along with 20+ posts on the forum but it never seems to work

  5. cw6365
    Member
    Posted 5 months ago #

    Yaayyy, i've got the solution, havent got a clue what it does or its side effects but it has solved both the problems, add the following to functions.php

    add_action('init', 'do_output_buffer');
    
    	function do_output_buffer() {
            ob_start();
    	}

    found over at stack overflow

  6. esmi
    Theme Diva & Forum Moderator
    Posted 5 months ago #

    Does nobody ever read error messages these days?

    (output started at /var/www/vhosts/clienttestdomain.co.uk/httpdocs/wp-content/plugins/film_db/filmdb.php:81)

    Now guess which plugin needs to be deactiveated/deleted?

  7. cw6365
    Member
    Posted 5 months ago #

    it's a custom plugin that runs half the system, what good is deleting/deactivating going to do? dont comment if your no use

  8. esmi
    Theme Diva & Forum Moderator
    Posted 5 months ago #

    Your custom plugin is the one generating the errors. You asked for the cause. That's it.

  9. cw6365
    Member
    Posted 5 months ago #

    what by deleting the plugin, very helpful!

Reply

You must log in to post.

About this Topic