## WordPress comments – how to check if comment still needs to be approved?

Question

I created a comments.php template and which contains the following code:

<div class="amb-single-comments amb-container-parent override">

<?php if ( post_password_required() ) {
return;
} ?>
<?php if ( have_comments() ) : ?>

'per_page' => '200',
'max_depth' => 20
] ); ?>
</ul>

<?php endif; ?>
<?php _e( 'Comments are closed.' ); ?>
</p>
<?php endif; ?>

<?php   $amb_comment_form_arguments = [ 'title_reply_before' => '<h3 id="reply-title" class="amb-comments-form-title comment-reply-title">', 'title_reply_after' => '</h3>', 'title_reply' => get_theme_mod('amb_single_styleparts_comments_formtitle', 'Leave a reply' ), ]; comment_form($amb_comment_form_arguments); ?>

</div>

</div>
</div>
</div>


The callback function for the wp_list_comments is only relevant for each individual comment, so I didn’t include it here.

The comment form all works as expected. However, I now have a problem with the moderation. When a user adds a comment, it is not visible directly. (I didn’t research if users can change this behaviour, but I guess they can.)

I want to add some text to show to the user after posting the comment that the comment first needs to be moderated. How can I show this? Or, better: how do I check after a comment is submitted, if this comment first needs to be moderated (or not)?

What is the best way to incorporate this message in a comments.php template?

0
1 year 2020-07-21T11:10:36-05:00 0 Answers 57 views 0