I know that I can require all of the comments on my site to be moderated, but is there a way of forcing moderation for a specific custom post type (i.e. my CPT "species") whilst allowing instantaneous comments across the rest of the site?

Thanks in advance,

2 Answers 2


Yes, this is possible. Comment moderation is an option, and is retrieved like any other option:


the get_option function applies a filter before returning the value...

return apply_filters( 'option_' . $option, maybe_unserialize( $value ) );

So what you'll want to do is add_filter('option_comment_moderation', 'check_moderable_post_types') and in your check_moderable_post_types function, check to see if the current post's post type is species. If so, return 1, and if not return the $value that is passed to the function!

Edit: This should do the trick:

add_filter('option_comment_moderation', 'check_moderable_post_types');
function check_moderable_post_types($value) {
    if (get_post_type() == 'species') return 1;
    return $value;
  • Hi Matthew, thanks for this - works perfectly. Much appreciated!
    – turbonerd
    Commented Jan 22, 2012 at 20:03

The previous answer doesn't work for me in WordPress 4.9.8. I figured it out with the help of pre_comment_approved hook.


add_filter('pre_comment_approved', 'misha_moderable_post_types', 10, 2);
function misha_moderable_post_types( $approved, $commendata ) {
    if ( get_post_type( $commendata['comment_post_ID'] ) === 'custom post type name' ){
        return true;
    return $approved;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.