WordPress Error Cannot Modify Header Information Headers Already Sent

We’re moving our blog from one host to another this week and I ran into an issue with WordPress moving things over.  When logging in you might get the WordPress error cannot modify header information headers already sent.  It took an hour or so and some cursing to sort it out and check out the following resources if you hit this type of error.

Warning: Cannot modify header information – headers already sent by (output started at /home/webad/public_html/blog/wp-content/themes/canvas/includes/widgets/widget-woo-embed.php:457) in /home/webad/public_html/blog/wp-includes/pluggable.php on line 876

The key to the error lies—in this case—with the widget-woo-embed.php file on line 457, which actually doesn’t exist as the file only has 260 lines. Check out this WordPress Codex article for information to help troubleshoot the error.

In my case, though, there was no whitespace to remove. Instead, it appeared that having certain content, i.e., the snippet below, caused the problem. So I finally removed the offending snippet, logged into the Admin page and then upgraded the theme containing the offensive content. Seems like that fixed the problem!

[sourcecode language=”php”]

<?php
if(is_active_widget( null,null,’woo_embed’ ) == true) {
add_action( ‘wp_footer’,’woo_widget_embed_js’ );
}

function woo_widget_embed_js(){
?>
<!– Woo Video Player Widget –>
<script type="text/javascript">
jQuery(document).ready(function(){
var list = jQuery(‘ul.widget-video-list’);
list.find(‘a’).click(function(){
var clickedTitle = jQuery(this).text();
jQuery(this).parent().parent().find(‘li’).removeClass(‘active’);
jQuery(this).parent().addClass(‘active’);
var videoHolders = jQuery(this).parent().parent().parent().children(‘.widget-video-unit’);
videoHolders.each(function(){
if(clickedTitle == jQuery(this).children(‘h4’).text()){
videoHolders.hide();
jQuery(this).show();
}
})
return false;
})
})
</script>
<?php
}
?>

[/sourcecode]

Comments are closed.

Sign in
classic
Forgot password?
×
Sign up

(*) Required fields

I agree with OptimaSales Terms & Privacy Policy

×