While designing the Unnamed WordPress Theme, which you can download for free here, I decided to design a feature that would tell commentators whether or not comments were being moderated, and if so, display whether all comments were being moderated, or only comments from new commentators. These options can be set in Settings > Discussion panel. The two options I wanted to check for were:
- The checkbox,“An administrator must always approve the comment,” and…
- The checkbox, “Comment author must have a previously approved comment”
Unfortunately, hours of searching turned up nothing about how I could get this done, although I did find this great Option Reference, which would have been nice to have before I spent a Saturday morning figuring this out on my own.
Turns out, WordPress’ get_option() function is what you need to test for those settings. So I added this code to my comments.php file and presto!
<?php if (get_option('comment_moderation') == 1) : ?>
<span>All comments are moderated before being shown</span>
<?php elseif(get_option('comment_whitelist') == 1) : ?>
<span>New comments are moderated before being shown</span>
<?php endif; ?>
Code Explanation
get_option(‘comment_moderation’) equals 1 when the checkbox, “An administrator must always approve the comment” is checked.
<?php get_option('comment_whitelist'); ?>
equals 1 when the checkbox, “Comment author must have a previously approved comment” is checked. Incidentally, when this checkbox is not checked,
<?php get_option('comment_whitelist'); ?>
returns null.

Thanx. I didn’t know anything about the Option Reference. This would be helpful to get the settings of a wordpress installation.