Author: Kiran Potphode

Most of sites running on WordPress don’t have complex implementation for contact forms. And almost every one of them use Contact Form 7 or shortly CF7.

CF7’s simple implementation puts it under must use WordPress plugins category.

Following are some most common requirements developers come across and their most common solutions:

Prevent spam by bots – A simple anti-spam functionality without need of any captcha.https://wordpress.org/plugins/contact-form-7-honeypot/
Concept of honeypot is as – most of the spams are not always manual. Most of them are bot submitted. Honeypot introduces extra field in form. Bots fill this extra field regardless it’s necessity. If this extra form field is filled then form not validate.

Redirect to another url after submissions- Normaly to show thank you page.
In additional setting tab put following line of code.

on_sent_ok: "location = 'http://example.com/';"

Where locations is page url where you want to redirect after submission.

Allow shorcode in Contact Form 7: Put following PHP code in functions file and allow WordPress shortcodes to work in CF7.