Support » Fixing WordPress » Another blank wp-comments-post.php problem…

  • Hi! Right, brace yourselves. This is going to be a long post.

    So I’m having the same problem that so many others have had. When I try to post a comment I am directed to a blank wp-comments-post.php page. Looking through Firebug reveals that no html or css is present. This happens every time whether I am logged in or not, and the comment never goes through. If I switch to a default theme, everything works fine, leading me to believe that there is a problem with my theme. Here’s where I started:

    1) WordPress Theme Tutorial. It’s an excellent, comprehensive tutorial for a newb like me. I followed it to the tee, got my blog sort of working, then spent awhile mastering the style sheet. By the way, my test installation is at this address:

    Now, however, the only thing not working that I really must have is comment posting. This is what I have tried:

    2) This post identified a problem with this line of code missing:

    <?php comment_id_fields(); ?>

    That, however, is clearly present in my comments.php file.

    3) I tried the phpMYadmin fix too. The table was successfully repaired or checked out ok, but nothing has changed.

    4) Some have had problems with Akismet. The plug-in is not and has never been activated on my blog as far as I know. It is installed, but not running.

    5) One person teetered on the verge of a mental breakdown over this line of code:

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

    That, it turns out, is exactly how the line looks in my comments.php. So I tried her other two alternatives:

    <input type="hidden" name="comment_post_ID" value="<?php the_ID(); ?>" />


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

    …success was met with neither.

    6) I removed white space at the bottom of wp-comments-post.php has per this post to no avail.

    7) I tried replacing my comments.php with this one as well as with the comments.php included with the two default themes. Nada.

    8) I also tried making a completely separate, fresh install and dropping in the theme I had developed. Fail to the power of 8.

    So. Where should I go next? Any thoughts? No idea is too hair-brained or outrageous for me to consider.

Viewing 15 replies - 1 through 15 (of 19 total)
  • Oh dear, I’m afraid I scared everyone off.

    There are two of us working on this site at the moment. Combined we’ve spent many hours googling for a solution. My compatriot and I are getting a bit discouraged, it seems like we tried everything known to fix the issue. Any thoughts? Anybody? I really don’t want to be left with just disabling comments forever.

    So I ran a page with comments through the validator:

    W3C Validator

    But I can’t figure out what the output means. It would seem that I have a character that is causing problems. Is there any chance this could be the cause of my commenting problems?

    Does your single.php include the comments file (as a PHP include) by any chance?

    I can’t see anything that is explicitly an include, like <?php include(); ?> or something like that. There is this line:

    <?php comments_template('', true); ?>

    Does that do the same thing? I apologize, I’ve gathered a pretty good grasp of CSS but PHP is still beyond me. Would it be helpful for me to post the whole single.php file?

    Some older themes use to display that problem, and they were using include instead of comments_template .. it’s why i asked..

    It’s quite evident the problem is with the theme, and if no amount of tickering with comments.php has proved useful (and replacing it didn’t help), then perhaps there’s something in the functions file that deals with comments..

    Can you pop it open and have a look.. (functions.php of your theme, assuming there is one)..

    There’s a lot of nonsense in the page source at the URL provided. Problem seems pretty obvious, there’s no value in comment_post_ID.

    You need to delete any code you obtained in step 5, put in the code from step 2, and if you got it right, you’ll be a mile closer to where you want to be.

    If you’ve already triple-checked that the code from step 2 is present and valid, then your theme is actually screwing up that particular function call, probably by modifying the $id variable, failing to call the_post(), or some other silly thing like that.

    Thanks all for the help, I really appreciate it.

    I’m quite certain that the code in step two is present. From step five, the code in my file is identical to what wordpress suggests. I did try the two alternatives from this step but I reverted when the did not work. Regardless, I will check both again in the morning just in case.

    From reading both of your posts together, I have a feeling I will find a problem in functions.php. Admittedly, I know there is a good amount of code provided by the tutorial that I will not employ, and I know that is not really a good practice when it comes to coding anything. When I feel more secure about how all the PHP works I might go through and try to clean it up.

    Maybe searching for $id will highlight the problem? I’ll post what I find.

    Thanks again!

    Checked items 2 and 5 again, they seem to be correct. I could not see anything in functions.php that looked like it was modifying $id, but I probably wouldn’t know it if I saw it. If you have the time, the functions.php from the tutorial is available on Google code. As far as I can tell mine is identical.

    @miqrogroove, you say that my theme might be failing to call the_post(). Where do you think I would find that? I searched comments.php for “the_post” and it returned nothing. Maybe it needs to be in there somewhere?

    That functions.php file looks fine. The problem is either in single.php, header.php, or one of your plugins.

    As miqrogroove said earlier, there’s no value for comment_post_ID , on top of that you’ve duplicated it to, it’s twice in the source when viewing your page..

    Here’s the code from your source.

    <input name="comment_post_ID" value="" id="comment_post_ID" type="hidden">

    Looking over your opening thread i can see you’ve altered this line to attempt to fix the initial problem.. (and duplicated it in the process)

    Can you change this back to read..

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

    Then load the page, and see if the output is given an ID correctly..

    If that doesn’t help, as mg said above it could be the header, comment out the get_header() line in single.php, test the page, see if that helps (don’t worry that the layout goes messed up, it’s simply a test, you can change it back after).

    1) No plug-ins running. There are a few installed, like Akismet, but none are activated.

    2) I couldn’t find this line anywhere in comments.php:
    <input name="comment_post_ID" value="" id="comment_post_ID" type="hidden">

    but I see that it is indeed showing up in the generated page source. Where else might this code be coming from?

    3) I tried removing the header and the footer individually, neither made a difference. I also tried removing both at the same time but to no avail.

    I’m curious, is there something specific you are looking for that tells you there’s no value for comment_post_ID? Or is the blank page the indicator?

    After trying this many different things, I’m starting to fear that the problem is a missing semicolon somewhere or something like that. :\ Is there anything left I can try?

    By the way, I made a dumb mistake a bit ago and messed up my original install, so here is a fresh new install with my theme dropped in.

    This bit indicates it’s missing a value..


    That should look something like..


    … or whatever it need be …

    I assumed it’s comments.php, because that i have the same code.

    Do you want me to take a look at it? .. under a temporary login..

    Well, I went looking for a private message service here on the forums so I could send you a temporary log-in but I see that none is present. Instead, here is a .zip archive of my theme: IanTest1.1

    Was there something in the Control panel that you wanted to check out?

    Thanks for the zip, now we don’t have to play guessing games 🙂

    Now, please read very carefully.

    In single.php, the function call named the_post() is missing. That call is literally the first part of “The Loop” in WordPress. Until that gets fixed all this other stuff will be broken.

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Another blank wp-comments-post.php problem…’ is closed to new replies.