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.
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?
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.phptries 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'];
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'];
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.
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.
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.
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:
Have you or your host changed any configuration files? I note that you have 3 comments, so it obviously worked at some point…
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!
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!
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.
Thanks in advance,
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.
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.
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?
anyone could tell me in which .php wordpress file is wp_redirect() function located? thanks
- The topic ‘Posting Comments Yields White Screen’ is closed to new replies.