# Reject Fluent Forms Messages in Foreign Scripts

> Stops Fluent Forms submissions that are written mostly in Cyrillic, Chinese or another script your business does not receive genuine messages in.

- Type: PHP
- Runs: Run everywhere
- Category: [Forms](https://wpide.com/library/category/forms/)
- Tags: fluent-forms, spam, language
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/fluentforms-non-latin-spam/

## Code

```php
$wpide_ff_blocked_scripts = array( 'Cyrillic', 'Han', 'Arabic', 'Hangul', 'Thai' );
$wpide_ff_script_share    = 0.3;

add_filter( 'fluentform/validation_errors', function ( $errors, $data ) use ( $wpide_ff_blocked_scripts, $wpide_ff_script_share ) {
    $text = '';
    foreach ( (array) $data as $name => $value ) {
        if ( is_string( $value ) && 0 !== strpos( (string) $name, '_' ) ) {
            $text .= ' ' . $value;
        }
    }

    $letters = preg_match_all( '/\p{L}/u', $text );
    if ( $letters < 10 ) {
        return $errors;
    }

    $foreign = 0;
    foreach ( $wpide_ff_blocked_scripts as $script ) {
        $foreign += (int) preg_match_all( '/\p{' . $script . '}/u', $text );
    }

    if ( $foreign / $letters >= $wpide_ff_script_share ) {
        $errors['message'] = array( 'Your message could not be sent.' );
    }

    return $errors;
}, 10, 2 );
```

## Notes

Remove scripts from the list that your customers actually write in.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Reject Fluent Forms Messages in Foreign Scripts" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
