# Reject Registrations Submitted Too Fast

> Stamps the WordPress registration form with a signed time and refuses sign-ups sent within a few seconds of loading it, which stops most registration bots.

- Type: PHP
- Runs: Run everywhere
- Category: [Security](https://wpide.com/library/category/security/)
- Tags: registration, spam, bots
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/registration-time-trap/

## Code

```php
$wpide_reg_min_seconds = 5;

add_action( 'register_form', function () {
    $time = (string) time();
    printf( '<input type="hidden" name="wpide_reg_ts" value="%s">', esc_attr( $time . '.' . wp_hash( 'reg-ts-' . $time ) ) );
} );

add_filter( 'registration_errors', function ( $errors ) use ( $wpide_reg_min_seconds ) {
    $stamp = isset( $_POST['wpide_reg_ts'] ) ? sanitize_text_field( wp_unslash( $_POST['wpide_reg_ts'] ) ) : '';
    $parts = explode( '.', $stamp, 2 );
    $valid = 2 === count( $parts ) && ctype_digit( $parts[0] ) && hash_equals( wp_hash( 'reg-ts-' . $parts[0] ), $parts[1] );

    if ( ! $valid || time() - (int) $parts[0] < $wpide_reg_min_seconds ) {
        $errors->add( 'wpide_too_fast', '<strong>Error:</strong> Please take a moment and try again.' );
    }

    return $errors;
} );
```

## Notes

Real people need a few seconds to type a username and email; raise the minimum if bots adapt.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Reject Registrations Submitted Too Fast" 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/
