Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've just received this error/warning after trying to upload an image, any ideas what it means and what I can do to fix it?

Warning: Cannot modify header information - headers already sent by (output started at /home/achenn/public_html/wp-content/themes/whskytngfxtrt/functions.php:14) in /home/achenn/public_html/wp-includes/pluggable.php on line 866

Here's my site, live.

functions.php:

<?php

// sidebar functions

if(function_exists('register_sidebar'))
{
    register_sidebar();
}


?>


<?php

// portfolio functions

    add_action('init', 'create_portfolio');
    function create_portfolio() {
        $portfolio_args = array(
            'label' => __('Portfolio'),
            'singular_label' => __('Portfolio'),
            'public' => true,
            'show_ui' => true,
            'capability_type' => 'post',
            'hierarchical' => false,
            'rewrite' => true,
            'supports' => array('title', 'editor', 'thumbnail')
        );
        register_post_type('portfolio',$portfolio_args);
    }
?>

<?php

// custom input- portfolio backend

    add_action("admin_init", "add_portfolio");
    add_action('save_post', 'update_website_url');
    function add_portfolio(){
        add_meta_box("portfolio_details", "Portfolio Options", "portfolio_options", "portfolio", "normal", "low");
    }
    function portfolio_options(){
        global $post;
        $custom = get_post_custom($post->ID);
        $website_url = $custom["website_url"][0];
?>
    <div id="portfolio-options">
        <label>Website URL:</label><input name="website_url" value="<?php echo $website_url; ?>" />     
    </div><!--end portfolio-options-->   
<?php
    }
    function update_website_url(){
        global $post;
        update_post_meta($post->ID, "website_url", $_POST["website_url"]);
    }
?>

<?php 

// detail columns- portfolio backend

add_filter("manage_edit-portfolio_columns", "portfolio_edit_columns");
add_action("manage_posts_custom_column",  "portfolio_columns_display");

function portfolio_edit_columns($portfolio_columns){
    $portfolio_columns = array(
        "cb" => "<input type=\"checkbox\" />",
        "title" => "Project Title",
        "description" => "Description",
    );
    return $portfolio_columns;
}

function portfolio_columns_display($portfolio_columns){
    switch ($portfolio_columns)
    {
        case "description":
            the_excerpt();
            break;              
    }
}
?>

portfolio.php-

<?php
/*
Template Name: Portfolio
*/
?>
<?php get_header(); ?>
    <div id="content">
    <?php 
        $loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => 10)); 
    ?>
    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <?php   
        $custom = get_post_custom($post->ID);
        $screenshot_url = $custom["screenshot_url"][0];
        $website_url = $custom["website_url"][0];
    ?>
        <div id="portfolio-item">
        <h1><?php the_title(); ?></h1>
        <a href="<?=$website_url?>"><?php the_post_thumbnail(); ?> </a>
        <?php the_content(); ?>
    </div>
        <?php endwhile; ?>  
        </div><!-- #content -->
<?php get_footer(); ?>
share|improve this question
1  
Did you read these answers? –  toscho Mar 26 '12 at 21:43
    
We need to know what's in your functions.php file to debug that. But the pluggable.php error is occuring when WP tries to redirect you somewhere else ... so something is happening on your site, but without seeing your code, we can't help! –  EAMann Mar 26 '12 at 21:44
    
just added! sorry for leaving it out. –  user1255049 Mar 26 '12 at 21:55

1 Answer 1

up vote 0 down vote accepted

From the looks of things, some page is trying to load your functions.php page directly. I'm not sure if it's another part of your theme, or a plugin, or some other custom code. But the error on line 14 is triggered with a second <?php opening tag in your functions.php file.

This headers already sent error is triggered when you send any additional whitespace, line returns, or text when you're not supposed to. A short-term fix is to remove the extra markup:

<?php // sidebar functions
if(function_exists('register_sidebar')) {
    register_sidebar();
}

// portfolio functions
add_action('init', 'create_portfolio');

See how much more compact that is? No extra white space between ?> and <?php either.

For the long-term, though, you need to narrow down exactly what you're doing. Where are you uploading the image from? Why is it trying to redirect to your functions.php file? Answer those questions and fix whatever problems are causing the issues for a more durable fix.

share|improve this answer
    
I've taken care of the white space now, thank you for that suggestion. When attempting to go to my portfolio page now, I'm greeted with this- Fatal error: Call to undefined function the_post_thumbnail() in /home/achenn/public_html/wp-content/themes/whskytngfxtrt/portfolio.php on line 19 Any ideas? –  user1255049 Mar 26 '12 at 22:53
    
That will be a separate question, but I'd need to see the code of your portfolio.php file ... it's obviously trying to call WP functions in a way that's breaking. –  EAMann Mar 26 '12 at 22:54
    
portfolio.php added above. thank you for your help.. i plan on launching my site tomorrow, but it seems my limited beginners knowledge is throwing up roadblocks left and right. –  user1255049 Mar 26 '12 at 23:48
    
You need to tell WordPress your site supports thumbnails first. Add add_theme_support('post-thumbnails'); to your functions.php file => nabtron.com/… –  EAMann Mar 26 '12 at 23:53
    
perfect! thank you!! –  user1255049 Mar 27 '12 at 0:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.