Title: Error: grecaptcha.execute is not a function
Last modified: June 27, 2020

---

# Error: grecaptcha.execute is not a function

 *  [eldoir](https://wordpress.org/support/users/eldoir/)
 * (@eldoir)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/error-grecaptcha-execute-is-not-a-function/)
 * Hello,
 * I get this annoying error in my console logs : “grecaptcha.execute is not a function”.
   (
   I’m in Contact Form 7 v5.1.4 but I think it appeared before)
 * When I click on the error, I see the error comes from wp-content/plugins/contact-
   form-7/modules/recaptcha.php, line 78.
 * I’ve searched on the web for nearly an hour, when I came here: [https://developers.google.com/recaptcha/docs/v3](https://developers.google.com/recaptcha/docs/v3)
   
   From that page, it seems like the code lacks the “grecaptcha.ready” part in order
   to work properly.
 * I added it before the call to grecaptcha.execute in the code, and now the error
   seems to be gone.
 * I’m creating this topic because I guess other people have/will have the same 
   issue as me, and also to know if there is a better solution (or if this is even
   a solution).
 * I’m afraid that this “fix” will be overwritten when I update Contact Form 7 next
   time…
 * Thanks!
    -  This topic was modified 6 years, 10 months ago by [eldoir](https://wordpress.org/support/users/eldoir/).
    -  This topic was modified 6 years, 10 months ago by [eldoir](https://wordpress.org/support/users/eldoir/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [giorgiodir](https://wordpress.org/support/users/giorgiodir/)
 * (@giorgiodir)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/error-grecaptcha-execute-is-not-a-function/#post-11805628)
 * hi i have your same problem can i ask you how you solved? what did you change
   precisely?
 *  Thread Starter [eldoir](https://wordpress.org/support/users/eldoir/)
 * (@eldoir)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/error-grecaptcha-execute-is-not-a-function/#post-11807455)
 * Hi [@giorgiodir](https://wordpress.org/support/users/giorgiodir/),
    I said it
   in my message but maybe it wasn’t clear, in the file wp-content/plugins/contact-
   form-7/modules/recaptcha.php, I added a call to grecaptcha.ready() just before
   the call to grecaptcha.execute(), according to the Google page I mentioned. If
   you’re not a developer, and you have the same version of Contact Form 7 as me(
   v.5.1.4, the last one), then you can just replace the lines 77-99 of the file
   with the following ones:
 *     ```
       execute: function( action ) {
         grecaptcha.ready(function() {
           grecaptcha.execute(
             sitekey,
             { action: action }
           ).then( function( token ) {
             var forms = document.getElementsByTagName( 'form' );
   
             for ( var i = 0; i < forms.length; i++ ) {
       	var fields = forms[ i ].getElementsByTagName( 'input' );
   
       	for ( var j = 0; j < fields.length; j++ ) {
       	  var field = fields[ j ];
   
       	  if ( 'g-recaptcha-response' === field.getAttribute( 'name' ) ) {
       	    field.setAttribute( 'value', token );
       	    break;
       	  }
       	}
             }
           });
         });
       },
       ```
   
    -  This reply was modified 6 years, 9 months ago by [eldoir](https://wordpress.org/support/users/eldoir/).
    -  This reply was modified 6 years, 9 months ago by [eldoir](https://wordpress.org/support/users/eldoir/).
    -  This reply was modified 6 years, 9 months ago by [eldoir](https://wordpress.org/support/users/eldoir/).

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Error: grecaptcha.execute is not a function’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

## Tags

 * [execute](https://wordpress.org/support/topic-tag/execute/)
 * [reCAPTCHA](https://wordpress.org/support/topic-tag/recaptcha/)

 * 2 replies
 * 3 participants
 * Last reply from: [eldoir](https://wordpress.org/support/users/eldoir/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/error-grecaptcha-execute-is-not-a-function/#post-11807455)
 * Status: not a support question