Add Custom Spam Filtering to CF7

Implements additional spam filtering for Contact Form 7 submissions

PHP

function custom_spam_check($spam, $submission) {
    $blacklist = array('[email protected]', '[email protected]');
    $email = $submission->get_posted_data('your-email');
    if (in_array($email, $blacklist)) {
        $spam = true;
    }
    return $spam;
}
add_filter('wpcf7_spam', 'custom_spam_check', 10, 2);

Snippet Feedback

Did this snippet work for you? Do you have any questions about this snippet? Leave some feedback below.

1 Views

Tags

Language

Did it work?

Save Snippet

Embed Snippet

To embed this snippet on your site, copy this html code and paste into your webpage. Learn more
By embedding snippets on your site, you are agreeing to our terms and conditions.

Embed Snippet

To embed this snippet on your site, copy this html code and paste into your webpage. Learn more
By embedding snippets on your site, you are agreeing to our terms and conditions.

Embed Snippet

To embed this snippet on your site, copy this html code and paste into your webpage. Learn more
By embedding snippets on your site, you are agreeing to our terms and conditions.