From a6bab1166d731af81fda658bf2655d3277a34c54 Mon Sep 17 00:00:00 2001 From: Ronald Huereca Date: Mon, 26 Aug 2024 02:14:44 -0500 Subject: [PATCH] Adding ability to limit moderation by new comments. --- includes/Ajax.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/Ajax.php b/includes/Ajax.php index 350316e..d20cad2 100644 --- a/includes/Ajax.php +++ b/includes/Ajax.php @@ -299,11 +299,13 @@ public static function ajax_save_comment() { // Short circuit comment moderation filter. add_filter( 'pre_option_comment_moderation', array( static::class, 'short_circuit_comment_moderation' ) ); add_filter( 'pre_option_comment_whitelist', array( static::class, 'short_circuit_comment_moderation' ) ); + add_filter( 'option_comment_moderation', '__return_false' ); // Needed to bypass moderation. if ( check_comment( $comment_to_save['comment_author'], $comment_to_save['comment_author_email'], $comment_to_save['comment_author_url'], $new_comment_content, $comment_to_save['comment_author_IP'], $comment_to_save['comment_agent'], $comment_to_save['comment_type'] ) ) { $comment_to_save['comment_approved'] = 1; } else { $comment_to_save['comment_approved'] = 0; } + remove_filter( 'option_comment_moderation', '__return_false' ); // Remove Short circuit comment moderation filter. remove_filter( 'pre_option_comment_moderation', array( static::class, 'short_circuit_comment_moderation' ) ); remove_filter( 'pre_option_comment_whitelist', array( static::class, 'short_circuit_comment_moderation' ) );