How to Change the URL For the reCAPTCHA Script


Are you interested in adjusting the location from which the Google reCAPTCHA script is loaded? If the default URL, with its associated cookies, doesn’t quite fit your needs, you’re in luck. With a simple PHP snippet, you can effortlessly modify the reCAPTCHA URL to better suit your preferences. Let’s walk through the steps to make this customization.


Simply add this snippet to your site. If you need any help in how to add snippets to your site, please see this tutorial.

 * Change reCAPTCHA URL script
 * @link

function wpf_dev_change_recaptcha_url( $captcha_api ) {
	return str_replace( '', '', $captcha_api );

add_filter( 'wpforms_frontend_captcha_api', 'wpf_dev_change_recaptcha_url', 10, 1 );

This snippet will look for the default reCAPTCHA URL and change it for what Google recommends.

And that’s it! Would you like to also change the language for reCAPTCHA? Check out our article on How to Set the Language for Google reCAPTCHA.