WordPress.org

Ready to get started?Download WordPress

Forums

warning cannot modify header information headers already sent by output (13 posts)

  1. salvadorfigueros
    Member
    Posted 2 years ago #

    Hi,
    I began using thesis template one week ago. I have implemented some changes and everything worked. Today, I have tried to login an this message appeared:

    Warning: Cannot modify header information - headers already sent by (output started at /homepages/18/d296768264/htdocs/salvadorfigueroscom/wp-content/themes/thesis_182/custom/custom_functions.php:1) in /homepages/18/d296768264/htdocs/salvadorfigueroscom/wp-includes/pluggable.php on line 934

    The site apparently works ( http://salvadorfigueros.com ) but when I try to login (via admin link) the message appears.
    I have tried everything: look for whitespace error in custom_functions.php file (none found), rewrite the code, copy a backup file from original download custom sample,... I cannot fix the error.

    I am not aware of having played with the first line of custom_functions.php:1 where the error is supposed to be. Everything looks OK but I cannot login.
    The code I have in that file is supposed to be the original. Here it is. (Please, have a look and let me know if there is some solution- Thanks a lot)

    <?php
    /*By taking advantage of hooks, filters, and the custom Loop API, you can make Thesis
    *do ANYTHING you want. For more information, please see the following articles from
    *the Thesis User’s Guide or visit the members-only Thesis support Forums:
    *
    * Hooks: http://diythemes.com/thesis/rtfm/customizing-with-hooks/
    * Filters: http://diythemes.com/thesis/rtfm/customizing-with-filters/
    * Custom Loop API: http://diythemes.com/thesis/rtfm/custom-loop-api/

    ---:[ place your custom code below this line ]:---*/

  2. Harry
    Member
    Posted 2 years ago #

    It's telling you this error is actually here;

    /homepages/18/d296768264/htdocs/salvadorfigueroscom/wp-includes/pluggable.php on line 934

    What is on line 934 of pluggable.php?

  3. salvadorfigueros
    Member
    Posted 2 years ago #

    Thanks for your comments, but I have not touched that file.

    To be honest, I do not know about programming or php but in all the forums I have visited everybody says that the file to fix is the first one. The second is a file that uses the first one.

    Anyway I checked line 934 of that file and everything was Ok (no whitespaces).

    Any idea?

  4. Harry
    Member
    Posted 2 years ago #

    I don't think the whitespace is the issue.

    Anytime I get that error it's because I've tried to use the php header() function. It tries to set the header, but because the header has already been set, it causes an error.

    So, could you copy that specific line here, just so I know what it's doing.

  5. Harry
    Member
    Posted 2 years ago #

    Oh, and it mightn't be that you've touched the file, I believe you, generally a plugin that has been enabled may have caused a conflict.

  6. salvadorfigueros
    Member
    Posted 2 years ago #

    Thanks for your comments. Here it is line 934

    header("Location: $location", true, $status);

    I do not know if it is correct but i have enclosed the line between upper commas (clicking code button) to show you the exact code and white space.

    On the other hand, I have realized that rss feed subscriptions has stopped working showing the same message error.

    Thanks.

  7. salvadorfigueros
    Member
    Posted 2 years ago #

    I think the warning error began when I replaced the image I had in the header of my bog. Maybe it has something to do with the error.

  8. salvadorfigueros
    Member
    Posted 2 years ago #

    I think it is solved.

    I read in an other forum that I had to work on the first file (output started at... custom_functions.php:1) open it with notepad and save it as ANSI (it was UTF-8). It has worked. I can login and work and everything seems to be right.

    What is the explanation behind?

    Thanks a lot for the support.

  9. Harry
    Member
    Posted 2 years ago #

    They are just different character sets used and can cause problems sometimes between say Windows and Unix/Linux based operating systems. Characters maybe misinterpreted causing the errors you saw.

    Great work on finding the solution. It would have been far down the list of my items to check.

  10. salvadorfigueros
    Member
    Posted 2 years ago #

    Thanks again

  11. David Radovanovic
    Member
    Posted 2 years ago #

    OMG - it was an ANSI format! Fixed my thesis after an upgrade to Thesis 1.8.2. That was an easy fix thanks to you guys. Thanks!!

  12. Sergey
    Member
    Posted 2 years ago #

    In widgets.php there's 2 spaces AFTER ?> at the very end ...

    add_action('widgets_init', 'arras_widgets_init', 1);	
    
    /* End of file widgets.php */
    
    /* Location: ./library/widgets.php */
    
    ?>
    <strong>"Space"
    "Space"
    </strong>

    After removing everything worked even without saving it in ANSI.

    [Please post code snippets between backticks or use the code button.]

  13. dsmith79
    Member
    Posted 1 year ago #

    Hi

    I have a similar issue to salvadorfigueros who started this thread. I made a change to my custom_functions.php script in the Thesis theme and now when I try to log in to wp-admin it gives me the following error message:

    "Warning: Cannot modify header information - headers already sent by (output started at /home/altparis/public_html/wp-content/themes/thesis_184/custom/custom_functions.php:1) in /home/altparis/public_html/wp-includes/pluggable.php on line 881"

    The site is viewable, however.

    Originally I had another error message, which if I remember correctly was something along the lines of:

    Parse error: syntax error, unexpected $end in /XXX/themes/thesis_17/custom/custom_functions.php on line x.

    At that junction the site wasn't even viewable.

    I reset custom_functions.php in my hosting Cpanel to what it was before the hiccup , and now I just receive the former error message and the site is viewable.

    Please let me know if there's a solution as I've got to a point with the design I'm happy with and really don't want to have to wipe the slate and start again.

    Here's the custom-functions.php code as it is installed now.

    <?php
    /* By taking advantage of hooks, filters, and the Custom Loop API, you can make Thesis
     * do ANYTHING you want. For more information, please see the following articles from
     * the Thesis User’s Guide or visit the members-only Thesis Support Forums:
     *
     * Hooks: http://diythemes.com/thesis/rtfm/customizing-with-hooks/
     * Filters: http://diythemes.com/thesis/rtfm/customizing-with-filters/
     * Custom Loop API: http://diythemes.com/thesis/rtfm/custom-loop-api/
    
    ---:[ place your custom code below this line ]:---*/
    
    remove_action  ('thesis_hook_before_header', 'thesis_nav_menu');
    add_action ('thesis_hook_after_header', 'thesis_nav_menu');
    remove_action('thesis_hook_footer', 'thesis_attribution');
    function copyright() {
    		echo '<p>Copyright Alternative Paris ' . date('Y') . '</p>';
    }
    add_action('thesis_hook_footer', 'copyright', '99');
    
    function custom_remove_defaults($content) {
    	return false;
    }
    
    function my_sales_page() {
    	if (is_page('39')) {
    		add_filter('thesis_show_header', 'custom_remove_defaults');
    		add_filter('thesis_show_sidebars', 'custom_remove_defaults');
    		add_filter('thesis_show_footer', 'custom_remove_defaults');
    	}
    }
    
    add_action('template_redirect','my_sales_page');
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic