Willi
Willi

Reputation: 126

Awaiting Moderation Message not showing up in WordPress 4.9.6

I'm working on my comment-section.

I have a very basic custom Comment_Walker. But it doesn't show the "Awaiting Moderation" string after posting a comment.

Comments are posted successfully to the backend. I have ticked that comments have to be manually approved in the settings in the backend. A comment shows in the comment section in the backend as "pending". But I won't get the message when posting the comment.

My Walker File (very basic reduced to demonstrate)

<?php
/** Custom Comment Walker Basic */

class Custom_Comment_Walker extends Walker_Comment {

    protected function html5_comment( $comment, $depth, $args ) {

        $tag = ( $args['style'] === 'div' ) ? 'div' : 'li';
        ?>      
        <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( $this->has_children ? 'has-children col-12 p-0' : 'p-0 col-12 list-unstyled' ); ?>>


        <div>
            <?php echo get_comment_text(); ?>
            <?php if ( '0' == $comment->comment_approved ) : ?>
                Awaiting Moderation
            <?php endif; ?>  
        </div>

        <?php
    }   
}

Accessing it via:

<div class="comment-list">
    <?php 
      wp_list_comments( array(
          'walker'        => new Custom_Comment_Walker()
      ) );
    ?>
</div>

I don't quite understand why the message wouldn't show up. Do I oversee something here? Using the latest WordPress 4.9.6 on a localhost. I did deactivate literally every plugin I've had active before posting here. I have also tested this with different accounts and roles.

Upvotes: 1

Views: 795

Answers (1)

Willi
Willi

Reputation: 126

Apparently the solution was to have the "Save my name, email, and website in this browser for the next time I comment." checkbox selected in order for the message to show up.

So you have to have the GDPR checkbox to be checked in order to have the comment and message appearing before approval.

Sorry for bothering.

Upvotes: 1

Related Questions