# Limit Fluent Forms Submissions per Visitor

> Allows only a few Fluent Forms submissions per IP address each hour and shows a polite message after that, which stops flooding and repeated spam.

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

## Code

```php
$wpide_ff_max_per_hour = 3;

$wpide_ff_rate_key = function () {
    $ip = isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : '';

    return 'wpide_ff_rate_' . md5( wp_salt() . $ip );
};

add_filter( 'fluentform/validation_errors', function ( $errors ) use ( $wpide_ff_max_per_hour, $wpide_ff_rate_key ) {
    if ( (int) get_transient( $wpide_ff_rate_key() ) >= $wpide_ff_max_per_hour ) {
        $errors['_wpide_rate_limit'] = array( 'You have sent several messages recently. Please try again later.' );
    }

    return $errors;
}, 20 );

add_action( 'fluentform/submission_inserted', function () use ( $wpide_ff_rate_key ) {
    $key = $wpide_ff_rate_key();
    set_transient( $key, (int) get_transient( $key ) + 1, HOUR_IN_SECONDS );
} );
```

## Notes

IPs are stored only as hashes in short-lived transients; raise the limit for forms used from shared offices.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Limit Fluent Forms Submissions per Visitor" 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/
