USP Pro makes it easy to add an anti-spam captcha field to any form. Using the USP General settings, you can customize to the captcha field to display either a challenge question, Google reCAPTCHA version 1, or Google reCAPTCHA version 2. This tutorial explains how to add custom URL parameters when using the newer Google reCAPTCHA version 2. This technique can be used, for example, to customize the language used by the reCAPTCHA field.

Step 1

Visit General ▸ Antispam/Captcha ▸ reCAPTCHA Version, and select “Version 2 (noCAPTCHA reCAPTCHA)”. Save your changes.

Step 2

Add the following code to your theme’s functions.php file:

function shapeSpace_custom_recaptcha_parameters() {
	return '?hl=es';
}
add_filter('usp_captcha_params', 'shapeSpace_custom_recaptcha_parameters');

Here we are returning ?hl=es to the reCAPTCHA URL, so that the Spanish Language will be used for the captcha field. You can choose another langauge or customize the return value with any query-string parameters that are required.

Resources