### [How to Change the URL For the reCAPTCHA Script](https://wpforms.com/developers/how-to-change-the-url-for-the-recaptcha-script/)

**Published:** November 19, 2021
**Author:** Editorial Team

**Excerpt:** This article will show you how to change the URL script where reCAPTCHA is loaded from. 

**Content:**

## Overview

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.

## Setup

Simply add this snippet to your site. If you need any help in how to add snippets to your site, [please see this tutorial](https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/ "How to Add Custom PHP or JavaScript for WPForms").

```

/**
 * Change reCAPTCHA URL script
 *
 * @link   https://wpforms.com/developers/how-to-change-the-url-for-the-recaptcha-script/
 */

function wpf_dev_change_recaptcha_url( $captcha_api ) {
	
	return str_replace( 'https://www.google.com/recaptcha/api.js', 'https://www.recaptcha.net/recaptcha/api.js', $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](https://wpforms.com/developers/how-to-set-the-language-for-google-recaptcha/ "How to Set the Language for Google reCAPTCHA").

**Categories:** Snippets

**Tags:** PHP

---

