Title: [Plugin errors] Cannot modify header information &#8211; headers already sent
Last modified: August 19, 2016

---

# [Plugin errors] Cannot modify header information – headers already sent

 *  [kyleabaker](https://wordpress.org/support/users/kyleabaker/)
 * (@kyleabaker)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/plugin-errors-cannot-modify-header-information-headers-already-sent/)
 * I’ve modified a plugin that I used to use that just didn’t do exactly what I 
   wanted it to do, but now I’m having a problem with it when users are posting 
   on my website who are not registered or signed in.
 * The errors are the following:
    ` Warning: Cannot modify header information - 
   headers already sent by (output started at /home/.hantu/site.com/wp-content/plugins/
   wp-useragent/wp-useragent.php:378) in /home/.hantu/site.com/wp-comments-post.
   php on line 79
 * Warning: Cannot modify header information - headers already sent by (output started
   at /home/.hantu/site.com/wp-content/plugins/wp-useragent/wp-useragent.php:378)
   in /home/.hantu/site.com/wp-comments-post.php on line 80
 * Warning: Cannot modify header information - headers already sent by (output started
   at /home/.hantu/site.com/wp-content/plugins/wp-useragent/wp-useragent.php:378)
   in /home/.hantu/site.com/wp-comments-post.php on line 81
 * Warning: Cannot modify header information - headers already sent by (output started
   at /home/.hantu/site.com/wp-content/plugins/wp-useragent/wp-useragent.php:378)
   in /home/.hantu/site.com/wp-includes/pluggable.php on line 850
 * As you can see, there are 3 files involved. The wp-useragent.php file is one 
   file from the plugin that I modified and the modified version v0.5.3.4 can be
   found here [http://kyleabaker.com/goodies/coding/wp-useragent/](http://kyleabaker.com/goodies/coding/wp-useragent/)
   if you want to inspect the plugin.
 * Otherwise, the errors from the line numbers are as follows:
 * wp-useragent.php:378
    else{echo $surfing.” “;}
 * wp-comments-post.php:79-81
    setcookie(‘comment_author_’ . COOKIEHASH, $comment-
   >comment_author, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); setcookie(‘comment_author_email_’.
   COOKIEHASH, $comment->comment_author_email, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
   setcookie(‘comment_author_url_’ . COOKIEHASH, clean_url($comment->comment_author_url),
   time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
 * wp-includes/pluggable.php:850
    header(“Location: $location”);

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [kyleabaker](https://wordpress.org/support/users/kyleabaker/)
 * (@kyleabaker)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/plugin-errors-cannot-modify-header-information-headers-already-sent/#post-977627)
 * I’ve already read the FAQ page about this issue and it’s not an issue with the
   starting and ending php tags.
 * I really don’t know what I would need to do to fix it so if someone could download
   the plugin and give it a shot then I would really appreciate any help!
 *  Thread Starter [kyleabaker](https://wordpress.org/support/users/kyleabaker/)
 * (@kyleabaker)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/plugin-errors-cannot-modify-header-information-headers-already-sent/#post-977631)
 * One thing that would solve the problem is if I could just tell the plugin to 
   not run on the wp-comments-post.php page when submitting content and only run
   when displaying a post and previously made comments.
 *  Thread Starter [kyleabaker](https://wordpress.org/support/users/kyleabaker/)
 * (@kyleabaker)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/plugin-errors-cannot-modify-header-information-headers-already-sent/#post-977718)
 * bump
 *  Thread Starter [kyleabaker](https://wordpress.org/support/users/kyleabaker/)
 * (@kyleabaker)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/plugin-errors-cannot-modify-header-information-headers-already-sent/#post-977810)
 * Anyone care to help?
 *  Thread Starter [kyleabaker](https://wordpress.org/support/users/kyleabaker/)
 * (@kyleabaker)
 * [17 years ago](https://wordpress.org/support/topic/plugin-errors-cannot-modify-header-information-headers-already-sent/#post-977910)
 * I found a fix for this, just in case any other plugin developers are having the
   same problem.
 * Chances are pretty high that the problem is on a line where you’re trying to 
   echo something from your plugin.
 * Wrap the echo with the following conditional (blah and dots added as examples
   to wrap):
    ` if(empty($_POST['comment_post_ID'])) { echo "blah"; ... }
 * I hope this helps someone since it took me a long time to find a fix for this
   annoying problem. You’re welcome. 😉

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘[Plugin errors] Cannot modify header information – headers already sent’
is closed to new replies.

## Tags

 * [headers already sent](https://wordpress.org/support/topic-tag/headers-already-sent/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 5 replies
 * 1 participant
 * Last reply from: [kyleabaker](https://wordpress.org/support/users/kyleabaker/)
 * Last activity: [17 years ago](https://wordpress.org/support/topic/plugin-errors-cannot-modify-header-information-headers-already-sent/#post-977910)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
