Posting Comments Yields White Screen (16 posts)

  1. Konquest
    Posted 10 years ago #


    I've recently installed WordPress 1.5.2 by upgrading from a b2evolution blog. Everything went well (except some minor bugs). However, I have one that bugs me (no pun intended).

    When trying to post a comment, we are taken to a white screen and nothing happens. No comment passes through and is recorded in the DB. I have a custom skin, but it also happens with the default skin. My permalink is /%postname%/, but the problem also occurs with the default option.

    I've read the other support threads, but I'm pretty puzzled, as nothing came out of them.



  2. richardflynn
    Posted 10 years ago #

    I too am having this problem (my site is at http://www.richardflynn.net/articles) — I've seen a similar problem reported at http://wordpress.org/support/topic/40929, but the solutions suggested there didn't work for me — I tried disabling comment-related plugins but that didn't work, and comments have previously worked in my theme. Anyone got any ideas?
    Richard Flynn

  3. Alex Mills (Viper007Bond)
    Posted 10 years ago #

    I assume the URL in your address bar is wp-comments-post.php? If so, then it's most likely that you have referrers disabled in your browser.


    This is a bug of sorts. wp-comments-post.php tries to redirect you to the page you came from, but obviously doesn't work if you have referrers disabled. If the referrer is null, I'd say it should redirect back to the post that you just added a comment to. So, here's the code to do that. Some more advanced code could be used to redirect back to the post's permalink, if you're using permalinks that is.

    Anyway, replace this:

    $location = (empty($_POST['redirect_to'])) ? $_SERVER["HTTP_REFERER"] : $_POST['redirect_to'];

    With this:

    Erm, this may not work. I dunno. :/

    if (empty($_POST['redirect_to']) && empty($_SERVER["HTTP_REFERER"]))
    $location = get_bloginfo('url') . "/index.php?p=$comment_post_ID";
    else $location = (empty($_POST['redirect_to'])) ? $_SERVER["HTTP_REFERER"] : $_POST['redirect_to'];

  4. richardflynn
    Posted 10 years ago #

    Thanks for the help, Viper007Bond. Yes, the address bar shows http://www.richardflynn.net/articles/wp-comments-post.php, which is the correct location.

    However, I don't think this is the problem because HTTP referrers are working for me elsewhere (e.g. when using http://validator.w3.org/check?uri=referer). This is a problem that has been reported to me by several users now — for a while there, I was wondering why I wasn't getting any comments at all (although I knew people were reading the posts)!

    I did copy your code into the wp-comments-post.php file, commenting out the old line you mention. When you say that the code doesn't work, are you working on it?

    Thanks in advance to everyone who's able to point me in any direction to get this problem resolved.


  5. Alex Mills (Viper007Bond)
    Posted 10 years ago #

    I gave up trying to make it work. It shoulda worked, but it didn't and I don't know why.

    Anyway, since it's a problem for everyone (including me when I try to comment on your blog), try disabling all of your plugins.

  6. richardflynn
    Posted 10 years ago #

    Thanks again for replying so promptly.

    I tried disabling all plugins (except for Dunstan's Time Since, since doing so would break the site unless I rewrote the templates) but that didn't have any effect.

  7. justinbaeder
    Posted 10 years ago #

    you can conditionalize the plugin call before disabling it, so it won't break the site (unless it's something monstrously complex that I'm not thinking of). Instructions:

  8. Alex Mills (Viper007Bond)
    Posted 10 years ago #


    Have you or your host changed any configuration files? I note that you have 3 comments, so it obviously worked at some point...

  9. richardflynn
    Posted 10 years ago #

    Thanks, justinbaeder, for that suggestion. I've carried that out and have disabled all my plugins, and yet the problem remains that comments can't be posted!

  10. richardflynn
    Posted 10 years ago #

    OK, I've been working on this for a while now. I thought that perhaps it had something to do with the Subscribe to Comments plugin — I then discovered that I was using an out-of-date version. I upgraded to version 2.0, but still no comments can be posted on my site. This is driving me nuts!

  11. ofrias
    Posted 10 years ago #

    I am having a similar problem in one of my two blogs.

    Some users get a blank page when posting a comment in:

    While the same users with the same setup can comment successfully in this blog:

    I tried using the same (default) theme in both blogs and the behavior was the same.
    Wordpress configuration is exactly the same for both weblogs.

    The only difference in the setup is Apache/PHP/OS versions. You can check them at:

    Any idea?

    Thanks in advance,

  12. richardflynn
    Posted 10 years ago #

    Thanks for posting, Oscar — I'm glad to see that I'm not the only one who's having these problems! I hope we can both find a cure soon.

    Anyway, curiouser and curiouser — I was just looking at the Google Sitemaps statistics for my site (I have a sitemap in place which Google regularly downloads and supposedly crawls my site according to what it finds on the sitemap). In the latest statistics, it reports that it can't find my wp-post-comments.php file. If you visit the file on its own, you get a blank screen (as has already been reported) — the source is as follows:

    The whole thing is getting stranger and stranger. If anyone can think of anything I haven't tried yet, please chime in.

  13. richardflynn
    Posted 10 years ago #

    Hooray! I've finally got my comments working again. I recently redesigned the comments form in my custom theme but stupidly never properly tested it. In the course of the redesign I'd left out the following hidden field:
    <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />

    So, I put that back in and now thankfully everything is hunky-dory again. A timely reminder to me that it pays to check everything thoroughly when making any change, no matter how minor!

    Anyway, thanks for the help — I don't know if this'll help you, Oscar.


  14. ofrias
    Posted 10 years ago #

    Just a clarification. wp-comments-post.php returns a blank page if you directly access it, this is OK, not a problem.
    Richard, thanks, but all the parameters are OK in my templates, this is not the problem.

    Any other idea?

  15. goljadkin
    Posted 10 years ago #

    anyone could tell me in which .php wordpress file is wp_redirect() function located? thanks

  16. AlphawolfWMP
    Posted 9 years ago #

    Hey everyone,
    got the same problem. But I do have a clue:

    <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />

    When I watch this in the source code the value is empty so I guess the var $id wasn't passed. What can I do?

Topic Closed

This topic has been closed to new replies.

About this Topic