How to Auto Approve Comments on a Specific Page?

Considering that in Settings > Discussion you have this options checked:

comments moderation and whitelist options

The first is comment_moderation and the second comment_whitelist.

Then, it is possible to selectively disable them using the filter pre_option_(option-name), as follows:

add_filter( 'pre_option_comment_moderation', 'wpse_72990_auto_aprove_selective' );
add_filter( 'pre_option_comment_whitelist', 'wpse_72990_auto_aprove_selective' );

function wpse_72990_auto_aprove_selective( $option ) 
{  
    global $post;
    if( $post->ID == 2 ) 
        return 0;

    return $option;
}

Leave a Comment