WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Cannot modify header information - headers already sent by (8 posts)

  1. thehuzband
    Member
    Posted 4 years ago #

    Could someone point me in the right direction? I’m a little new to WordPress. I'm using version 2.9.2. When ever I attempt to edit the sidebar items, I get this error. Occasionally when I try to login I get the same error. The error stops when I remove the "functions.php" file, but leaves me with now sidebar functionality.

    This is the error I’m receiving and I am completely lost.

    Warning: Cannot modify header information - headers already sent by (output started at /home/samhoody/public_html/wp-content/themes/lyricalmindsmedia/functions.php:2)

  2. mrmist
    Forum Janitor
    Posted 4 years ago #

    This suggests that you are not including the opening php tags at the start of your functions php file, or are otherwise introducing content that causes the file to send output to the browser. The functions.php should only contain functions to be called from elsewhere.

  3. thehuzband
    Member
    Posted 4 years ago #

    I am unsure if this helps, but this is the information included in my functions.php file...

    | <?php
    if ( function_exists('register_sidebar') )
    register_sidebars(2, array(
    'before_widget' => '<ul class="category-bg widget %2$s">',
    'after_widget' => '',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));

    ?> |

  4. thedark
    Member
    Posted 4 years ago #

    Remove spaces and new lines before the first <?php tag. This should fix the problem.

  5. thehuzband
    Member
    Posted 4 years ago #

    Probably quite simple... Please clarify. ie. Example Structure
    Thanks

  6. mrmist
    Forum Janitor
    Posted 4 years ago #

    I'm not sure how much clearer he can be. Remove the spaces.

    |<?php

    Instead of

    | <?php

  7. Shane G.
    Member
    Posted 4 years ago #

    Hi,

    It is usually due to spaces, new lines, or other garbage at opening/closing PHP file <?php tag or after a closing ?> tag in wp-config.php. It can be other file too so need to check error message as it may list file name where the error occurred.

    You can either upload error file from the backup or edit erroneous file. To edit the file one need to check below mentioned points:

    1. Download the file mentioned in the error message.
    2. Open that file in a plain text editor
    3. Check that the very first characters are <?php
    4. Check that the very last characters are ?>
    5. Place the cursor between the ? and >
    6. Now press the DELETE key on your computer and keep that key pressed for at least 15 seconds.
    7. Now type > and
    8. Save without pressing any other key at all.

    That’s it!

    Thanks,

    Shane G.

  8. thehuzband
    Member
    Posted 4 years ago #

    Thanks... Issue resolved.

Topic Closed

This topic has been closed to new replies.

About this Topic