WordPress.org

Ready to get started?Download WordPress

Forums

"Warning: Cannot modify header information" (7 posts)

  1. Lauren
    Member
    Posted 1 year ago #

    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?

  2. esmi
    Forum Moderator
    Posted 1 year ago #

  3. potentweb
    Member
    Posted 1 year ago #

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

  4. Lauren
    Member
    Posted 1 year ago #

    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?

  5. Lauren
    Member
    Posted 1 year ago #

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

    <?php
    
    	add_theme_support( 'post-thumbnails' ); 
    
    ?>

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

  6. potentweb
    Member
    Posted 1 year ago #

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

  7. Lauren
    Member
    Posted 1 year ago #

    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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    <head profile="http://gmpg.org/xfn/11">
    <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">
    
    <?php
    // Checks to see whether it needs a sidebar or not
    if ( !empty($withcomments) && !is_single() ) {
    ?>
    
    <?php } ?>
    
    </style>
    
    <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
    
    <?php wp_head() ?>
    
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    
    <SCRIPT TYPE="text/javascript">
    <!--
    //Disable right click script
    //visit http://www.rainbow.arch.scriptmania.com/scripts/
    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.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
    document.oncontextmenu=new Function("return false")
    // -->
    </SCRIPT> 
    
    </head>
    
    <body>
    
    <div id="wrapper">

Topic Closed

This topic has been closed to new replies.

About this Topic