Contact Form 7 5.1.4 is now available. This is a maintenance release that includes some bug-fixes and improvements.
Alternative Way to Set reCAPTCHA API Keys
To use reCAPTCHA, you need to set reCAPTCHA v3 API keys (the site key and secret key) on the Integration screen.
Contact Form 7 5.1.4 introduces an alternative way to set those keys, and it would be useful to share the same API key pair among different domains.
You can set the keys using the WPCF7_RECAPTCHA_SITEKEY and WPCF7_RECAPTCHA_SECRET constants like the following:
define( 'WPCF7_RECAPTCHA_SITEKEY', '(site key here)' ); define( 'WPCF7_RECAPTCHA_SECRET', '(secret key here)' );
You can also do the same thing using the wpcf7_recaptcha_sitekey and wpcf7_recaptcha_secret filter hooks:
add_filter( 'wpcf7_recaptcha_sitekey', function( $sitekey ) {
return '(site key here)';
} );
add_filter( 'wpcf7_recaptcha_secret', function( $secret ) {
return '(secret key here)';
} );
Needless to say, you will still need to register the sites correctly on Google’s reCAPTCHA configuration page. Otherwise reCAPTCHA won’t work on your sites. For details about reCAPTCHA setup, see reCAPTCHA (v3).
Requires: WordPress 4.9 or higher
Tested up to: WordPress 5.2.2
» Download Contact Form 7 plugin from WordPress.org
Change Log
- reCAPTCHA: introduces the
WPCF7_RECAPTCHA_SITEKEYandWPCF7_RECAPTCHA_SECRETconstants. - reCAPTCHA: Introduces the
wpcf7_recaptcha_sitekeyandwpcf7_recaptcha_secretfilter hooks. - Adds
$statusparameter to thewpcf7_form_response_outputfilter. - Creates a nonce only when the submitter is a logged-in user.
- Introduces
WPCF7_ContactForm::unit_tag(), a public method that returns a unit tag. - reCAPTCHA: gives a different spam log message for cases where the response token is empty.
- Acceptance Checkbox: supports the
label_firstoption in anacceptanceform-tag.