I’ve got a solution. I added this code to a custom plugin:
function remove_cf7_spam_filter(){
remove_filter('wpcf7_spam', 'wpcf7_disallowed_list', 10);
}
add_action( 'after_setup_theme', 'remove_cf7_spam_filter' );
add_filter( 'wpcf7_spam', 'wpcf7_disallowed_list2', 10, 2 );
function wpcf7_disallowed_list2( $spam, $submission ) {
if ( $spam ) {
return $spam;
}
$target = $submission->get_posted_data();
// Don't spam check these fields:
if(array_key_exists('g-recaptcha-response', $target)) unset ($target['g-recaptcha-response']);
$target = wpcf7_array_flatten( $target );
$target[] = $submission->get_meta( 'remote_ip' );
$target[] = $submission->get_meta( 'user_agent' );
$target = implode( "\n", $target );
$word = wpcf7_check_disallowed_list( $target );
$word = wpcf7_apply_filters_deprecated(
'wpcf7_submission_is_blacklisted',
array( $word, $submission ),
'5.3',
'wpcf7_submission_has_disallowed_words'
);
$word = apply_filters(
'wpcf7_submission_has_disallowed_words',
$word,
$submission
);
if ( $word ) {
if ( is_bool( $word ) ) {
$reason = __( "Disallowed words are used.", 'contact-form-7' );
} else {
$reason = sprintf(
__( "Disallowed words (%s) are used.", 'contact-form-7' ),
implode( ', ', (array) $word )
);
}
$submission->add_spam_log( array(
'agent' => 'disallowed_list',
'reason' => $reason,
) );
}
$spam = (bool) $word;
return $spam;
}