WordPress filter hook

wpcf7_validate

Fired by 6 WordPress plugins, running on 10M+ sites between them.

How to use wpcf7_validate

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'wpcf7_validate', function( $result, $tags ) {
	// Change $result here.
	return $result;
}, 10, 2 );

Argument names come from Contact Form 7's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

6 plugins that fire wpcf7_validate

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Contact Form 7 icon Contact Form 710+ million installs apply_filters( 'wpcf7_validate', $result, $tags ) includes/submission.php:584
  2. Multi Step for Contact Form 7 icon Multi Step for Contact Form 710,000+ installs apply_filters( 'wpcf7_validate', $result, $tags ) inc/frontend/validation.php:250
  3. Contact Form Multi-Step Addon icon Contact Form Multi-Step Addon200+ installs apply_filters( 'wpcf7_validate', $result, $tags ) includes/multistep-form-class.php:316
  4. Accept Authorize.NET Payments Using Contact Form 7 icon Accept Authorize.NET Payments Using Contact Form 7100+ installs apply_filters( 'wpcf7_validate', $result, $tags ) inc/class.cf7adn.php:213
  5. Plugear Review Step for Contact Form 7 icon Plugear Review Step for Contact Form 740+ installs apply_filters( 'wpcf7_validate', $validity, $tags ) includes/rest/class-validate-controller.php:209
  6. Revisend for Contact Form 7 icon Revisend for Contact Form 7Fewer than 10 installs apply_filters( 'wpcf7_validate', $result, $tags ) includes/class-ajax.php:170

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.