This issue is certainly known to a few, and I too have had the problem for a while that I couldn’t leave any comments on my own blog when logged in as admin (I could comment only from the back end, but not from the website). Today I have finally taken the “time” to go to the root of the problem. I am writing this in quotes, because in the end it didn’t take me three minutes to find the error. If only I had started searching much earlier. ;)
The problem was a missing hidden input in the comment form, which is required by WordPress:
So if you constantly get a blank page after submitting a comment, you should check your comments template (usually that’s the file comments.php
in the directory of your theme) to see if this line has been forgotten or inserted at a wrong place.
In my case, for example, I had inserted the line in the wrong place inside an if statement:
You are logged in as ...
[Form fields for name, email etc.]
Thus the line was present for not logged-in visitors (guests), so they could comment without any problems. However, if you were logged in (which I, as the admin, of course always was), the line was missing, and if it’s missing, WordPress exits its comment script with a blank page without comment (haha!).
Correctly, it has to be like this of course:
You are logged in as ...
[Form fields for name, email etc.]
This way, the line is displayed in all cases, and then it also works as an admin!
One response to “Blank page after commenting on a WordPress post”
Thanks for this post! :)