Prevent or Stop Spam Emails in Contact form 7
If you're receiving spam emails through your Contact Form 7 (CF7) in WordPress, here are some effective ways to prevent them:
1. Use reCAPTCHA (Recommended)
2. Use Akismet Plugin
3. Enable a Honeypot Field using Plugin(Install and activate Contact Form 7 Honeypot plugin)
4. Custom Code (Best)
So this tutorial will not cover 1-3 points because that is self explained in the heading.
lets try 4th method, how to stop spam emails and block email in wordpress contact form 7 forms. we can use same method in any plugin or custom website.
First we need to add an hidden field in our cf7 form. Add below code in your contact form
and this code you can add in contact form 7
but if you have multiple forms in a page then dont add it in contact form 7 instead add in your core js file or in footer.
Validate the Field in WordPress (functions.php)
Now, add validation code in functions.php to CF7 to reject spam submissions where the hidden field is missing or unchanged:
then in your css file add this code.
Comments
Post a Comment