Useful hooks in CF7

Contact form 7 has a few hooks that you can use to customize your forms. Here is a list of those hooks that I think are the most helpful.


This is great if you want to add custom shortcodes to be handled by Contact Form 7. The shortcodes can be used in your Dashboard when you define the form fields. More details here: How to add custom shortcodes in CF7.


This is fired just before the mail is sent. By this time, all validations have passed.


This is fired after the mail was sent. By this time, the $_POST is empty. Check this post for details on how to manipulate posted data in this hook: How to correctly get posted data in CF7.


This is a filter that helps us to validate fields using our own custom rules. Read this post for more information on how to do that: How to validate a field in CF7.