1

We currently have a problem with our contact form which marks normal messages from customers as spam.

We have a wordpress instilation with contact form 7 which our customers can use for te request a quote. We also have a recaptcha v3 installed. The problem arisses with the referer-page which it marks as spam. It marks words as not allowed such as (/p/) which we use for products in the link.

Is there a way to whitelist these words or remove them from auttomaticly being detected as spam?

  • 1
    Welcome to SO. Here at SO, we can help solve specific, technical problems, not open-ended requests for code or advice. This type of question is considered off-topic. https://stackoverflow.com/help/on-topic – Howard E Oct 27 '21 at 13:53
  • Also, unless you're doing some custom code work with Contact Form 7 this seems to be a question for the developer of the plugin and not something you should be troubleshooting here. See: https://wordpress.org/support/plugin/contact-form-7/ – cabrerahector Oct 27 '21 at 14:27

1 Answers1

1

the CF7 plugin provides 2 hooks to customise the SPAM validation process.

the first one wpcf7_skip_spam_check allows you to skip the spam validation altogether, so you could do something like this if your users are already logged in when using the form...

add_filter('wpcf7_skip_spam_check', '__return_true');

or you could all a function and check the $_POST and $_REQUEST objects to determine if the request validation can be skipped.

The 2nd filter wpcf7_spam is after the spam validation has been completed,

add_filter( 'wpcf7_spam', 'validate_spam',10,2);
function validate_spam($is_spam, $cf7_submission){
  if($is_spam){
    //you can inspect the spam log to see what went wrong,
    $array = $cf7_submission->get_spam_log();
    //and determine if the submission is valid,
    $is_spam = false;
  }
  return $is_spam;
}
Aurovrata
  • 2,000
  • 27
  • 45