Support » Themes and Templates » "Warning: Cannot modify header information"

  • I’m coding a website for a friend, and I keep getting this error whenever I try to submit something new (like a new post):

    Warning: Cannot modify header information – headers already sent by (output started at /home/cpiekarz/public_html/URBANSAFARIPHOTOGRAPHY.COM/wp-content/themes/safari/functions.php:1) in /home/cpiekarz/public_html/URBANSAFARIPHOTOGRAPHY.COM/wp-includes/pluggable.php on line 881

    Any ideas how to solve this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • esmi


    Forum Moderator

    Usually caused by adding whitespace before or after opening and closing php tag.

    It says that the error is in the functions.php file of my “Safari” theme in line 1. I’ve messed with this file for the last hour. I’ve done the following:

    1. Made sure there are no spaces at the beginning or end of the file near the tags

    2. Attempted to take out all the functions.php code except the opening and closing php tags, with no extra spaces before or after

    3. Pasted the function.php codes from other WordPress themes into my file

    but none of these options work.

    The ONLY thing that works is deleting my functions.php file completely, but I need that file so that I can use post thumbnails in my posts.

    Any suggestions?

    All I need my functions.php file for is so that I can have post thumbnails. Here is my code:

    	add_theme_support( 'post-thumbnails' ); 

    There are no extra spaces, but I keep getting the error.

    Check your header.php page. Make sure there are no white spaces on top.

    Thanks for the tip. I checked, and I don’t think there are any extra spaces. Here is my header.php page:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
    <html xmlns="" <?php language_attributes(); ?>>
    <head profile="">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    <title><?php wp_title('|', true, 'right'); ?> Title Here</title>
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    <style type="text/css" media="screen">
    // Checks to see whether it needs a sidebar or not
    if ( !empty($withcomments) && !is_single() ) {
    <?php } ?>
    <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
    <?php wp_head() ?>
    <script type="text/javascript" src=""></script>
    <SCRIPT TYPE="text/javascript">
    //Disable right click script
    var message="Sorry, right-click has been disabled";
    function clickIE() {if (document.all) {(message);return false;}}
    function clickNS(e) {if
    (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {(message);return false;}}}
    if (document.layers)
    document.oncontextmenu=new Function("return false")
    // -->
    <div id="wrapper">
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘"Warning: Cannot modify header information"’ is closed to new replies.