Does the Contact Form 7 plugin have a filter similar to WordPress's preprocess_comment?

I'll be using this filter to check the body of the message for certain words and call wp_die() to display a message and prevent further processing of the message.


I think wpcf7_before_send_mail is what you're looking for.

You can find some examples of it in action in this unofficial documentation and in this support thread where the plugin developer gives some guidance on using it..

| improve this answer | |
  • Thanks Jay that was exactly what I was looking for. One more problem, I'd like to check if this hook exists before add_action() I though of using has_action() to do it. But I find that even if the plugin isn't installed add_action('wpcf7_before_send_mail','my_func') doesn't show any error or warning. Is it OK if I leave to this way ro should I check for a hook's existence before using add_action() – A.Jesin Sep 20 '13 at 11:27
  • This other question has a nice answer for that: wordpress.stackexchange.com/questions/72652/… -- in short, check if the plugin is active rather than if the hook is available. – Jay Neely Sep 23 '13 at 21:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.