groundhogg/form/submission_handler/is_spam

πŸ“… Published on

πŸ“ Last updated

Documentation

Β»

Filter Hooks

Β»

groundhogg/form/submission_handler/is_spam

Filters whether a form submission should be treated as spam. Return true to reject the submission from your own spam detection logic.

apply_filters( 'groundhogg/form/submission_handler/is_spam', $is_spam );

You will receive the current boolean spam determination.

Example

add_filter( 'groundhogg/form/submission_handler/is_spam', 'my_extension_check_spam' );

/**
 * Reject submissions from disposable email domains.
 *
 * @param bool $is_spam
 *
 * @return bool
 */
function my_extension_check_spam( $is_spam ) {
    if ( $is_spam ) {
        return true;
    }

    $email  = sanitize_email( $_POST['email'] ?? '' );
    $domain = substr( strrchr( $email, '@' ), 1 );

    return my_extension_is_disposable_domain( $domain );
}

Was this helpful?

Let us know if this document answered your question. That’s the only way we can improve.