your comment awaiting moderation message sometimes not appearing

admin2025-06-06  3

On a new wordpress site I realise that sometimes when testing the comments feature for posts that the "your comment is awiting moderation" message does not appear.

When a comment is posted, the url of the page when it refreshes contains an anchor to the wrapping div of the new comment. In that div instead of showing the comment when a normal user makes the comment, a message "your comment is awaiting moderation" normally appears.

When this problem occurs though, although the anchor is still in the url of the returning page, the entire comment element isn't in the html. This means that the anchor point doesn't exist, so when the page loads, instead of jumping down to the last comment point it stays at the very top.

Repeating this problem reliably has been incredibly difficult. There was a hunch to start with that it occured only for certain browsers. Then when I realised that the returning html from the php simply was missing the comment just made (or its wrapper and awaiting message at least) I realised something very fundamental had to be going on.

My hunch is that this is beccause my test messages (which often contain just a few words or characters and aren't really accurate representations of a real message) were caught by Askimet (yes its installed and running) and marked as spam. I've found some of my tests as marked as spam and so I've concluded this is probably the reason for the awaiting moderation message not appearing.

However I've also definitely not had the message appear and the test comment I made was cleared as ok by askimet. So I'm not sure if my assumption is completely/at all correct.

Does anyone know about the internal workings of this and can confirm why this message may not appear?

On a new wordpress site I realise that sometimes when testing the comments feature for posts that the "your comment is awiting moderation" message does not appear.

When a comment is posted, the url of the page when it refreshes contains an anchor to the wrapping div of the new comment. In that div instead of showing the comment when a normal user makes the comment, a message "your comment is awaiting moderation" normally appears.

When this problem occurs though, although the anchor is still in the url of the returning page, the entire comment element isn't in the html. This means that the anchor point doesn't exist, so when the page loads, instead of jumping down to the last comment point it stays at the very top.

Repeating this problem reliably has been incredibly difficult. There was a hunch to start with that it occured only for certain browsers. Then when I realised that the returning html from the php simply was missing the comment just made (or its wrapper and awaiting message at least) I realised something very fundamental had to be going on.

My hunch is that this is beccause my test messages (which often contain just a few words or characters and aren't really accurate representations of a real message) were caught by Askimet (yes its installed and running) and marked as spam. I've found some of my tests as marked as spam and so I've concluded this is probably the reason for the awaiting moderation message not appearing.

However I've also definitely not had the message appear and the test comment I made was cleared as ok by askimet. So I'm not sure if my assumption is completely/at all correct.

Does anyone know about the internal workings of this and can confirm why this message may not appear?

Share Improve this question edited Nov 29, 2013 at 21:40 AdamJones asked Nov 29, 2013 at 12:15 AdamJonesAdamJones 3282 gold badges7 silver badges26 bronze badges 4
  • It is very hard to make a guess about thing like this. Can you come up with exact steps that demonstrate the issue? – Rarst Commented Nov 29, 2013 at 17:00
  • I'm updating the question Rarst with more info... – AdamJones Commented Nov 29, 2013 at 21:39
  • @AdamJones did you ever figure this out? I have the same issue but I believe it may be due to a staging environment? It seems the cookies are not being set for comments. – Radmation Commented Jun 14, 2018 at 20:52
  • @Radmation I'm going to write my solution in an answer,... – AdamJones Commented Jun 22, 2018 at 12:41
Add a comment  | 

1 Answer 1

Reset to default 1

I got around this by handling it all in JS / Jquery.

On a jQuery document ready clause I look for a specific type of anchor on page load and if that is present I assume that a message has just been posted. I then using jQuery display a nice little alert message up top of the page.

For the purpose of the sample code below I've used a standard JS alert function call to display the msg so you could alter this and make your own msg displaying function.

$(document).ready(function()  { 

    // check for comment posts
    if(window.location.hash) {
        var urlHash=window.location.hash;
        if(urlHash.indexOf('#comment-') === 0) {
            alert("Thank you for submitting your comment.  It will be reviewed and set live as soon as possible.);
        }
    }
});
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749153087a316817.html

最新回复(0)