How to Change the URL For the reCAPTCHA Script


Would you like to change the URL that the Google reCAPTCHA script is loaded from? If you rely on cookies that the default URL uses, you may find it useful to change the reCAPTCHA URL. Using a small PHP snippet you can easily change this URL and we’ll show you how.


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.