• 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 https://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

    (@kyleabaker)

    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

    (@kyleabaker)

    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

    (@kyleabaker)

    bump

    Thread Starter kyleabaker

    (@kyleabaker)

    Anyone care to help?

    Thread Starter kyleabaker

    (@kyleabaker)

    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.