Combat spam messages in WPForms on WordPress, consider these steps:
- Implement CAPTCHA: Enable CAPTCHA to validate that the form is being submitted by a human, not a spam bot.
- Utilize Honeypot Technique: Enable the honeypot technique, a hidden field that only bots will fill out, allowing you to detect and block spam submissions.
- Enable Form Submission Limits: Restrict the number of form submissions from a specific IP address within a defined timeframe to deter spam.
- Use Akismet Integration: Integrate Akismet, a spam filtering service, to identify and block spam submissions.
- Enable Email Confirmation: Set up email confirmation for form submissions, ensuring that only verified emails are accepted.
- Implement Time-based Restrictions: Restrict the frequency of form submissions from the same IP within a specific time frame to minimize spam.
- Customize Form Fields: Modify form fields to make them unique, making it harder for bots to autofill them.
- Review IP Blocking: Block suspicious IPs or IP ranges that consistently generate spam submissions.
- Regularly Update Plugins: Ensure WPForms and related plugins are up to date to benefit from the latest security features and improvements.
- Monitor Form Submissions: Regularly review form submissions to identify patterns of spam and adjust your spam prevention strategies accordingly.
Additionally you can use the code below that you will insert into a WordPress plugin for PHP code snippets.
/**
* Block domains inside the WPForms Paragraph Text
*/
function wpf_dev_prevent_domains_textarea( $field_id, $field_submit, $form_data ) {
if ( preg_match( '/www.|.com|.net|.org|http|https|.co.uk/', $field_submit ) ) {
wpforms()->get( 'process' )->errors[ $form_data[ 'id' ] ][ $field_id ] = esc_html__( 'URLs are not allowed to be submitted in this contact form.', 'plugin-domain' );
}
}
add_filter( 'wpforms_process_validate_textarea' , 'wpf_dev_prevent_domains_textarea', 10, 3 );
Implementing a combination of these strategies should significantly reduce spam submissions in WPForms on your WordPress website.