• Resolved dankfresh

    (@dankfresh)


    I have configured reCaptcha and inserted the tag into my form, but the form is not rendering.

    The code is there, I can see it in my source.

    This problem was illustrated in this thread – https://www.ads-software.com/support/topic/recaptcha-not-visible

    but no solution was provided other than the theme is responsible for messing up the output of the code. Can anyone provide insight as to why this is so I can modify my theme to make it work correctly?

    I am adding this to my functions.php file to get it to work correctly —

    wp_register_script('recaptcha_api', 'https://www.google.com/recaptcha/api.js');
    wp_enqueue_script('recaptcha_api');

    and it works… but can anyone elaborate as to why? I shouldn’t need to do this correct? Shouldn’t the integration work without me needing to add this, which means something is preventing it still correct?

    Thanks

    https://www.ads-software.com/plugins/contact-form-7/

Viewing 5 replies - 1 through 5 (of 5 total)
  • hassandad

    (@hassandad)

    I am facing same issue. wp_register_script return true at this point that means its registered but script doesn’t show in page source. I am developing theme myself. I tried it in fresh wordpress theme and it worked, but not including script in my theme. Can somebody tell me what am i missing in my theme?

    hassandad

    (@hassandad)

    @dankfresh I found issue in my theme, i forgot using wp_footer() in my footer. That was my issue. Look for your wp_head() or wp_footer(). Issue must be there. Thanks

    Thread Starter dankfresh

    (@dankfresh)

    Ah! Awesome! Thanks @hassandad that’s the fix! Hope this helps others!

    PosiWebDesign

    (@posiwebdesign)

    @dankfresh, where in the functions.php file do you put it? I put
    this at the very end of the file:
    function wp_register_script(‘recaptcha_api’, ‘https://www.google.com/recaptcha/api.js’);
    function wp_enqueue_script(‘recaptcha_api’);

    , and it gave me the error:

    Parse error: syntax error, unexpected ”recaptcha_api” (T_CONSTANT_ENCAPSED_STRING), expecting ‘&’ or variable (T_VARIABLE) in /home2/rltcoach/public_html/wp-includes/functions.php on line 5175

    When I put this at the very end of the file:
    wp_register_script(‘recaptcha_api’, ‘https://www.google.com/recaptcha/api.js’);
    wp_enqueue_script(‘recaptcha_api’);

    This is the error I get:
    Fatal error: Call to undefined function wp_register_script() in /home2/rltcoach/public_html/wp-includes/functions.php on line 5175

    Thanks for the help!

    jetblackpope

    (@jetblackpope)

    @dankfresh Thank you! I was running into this same issue and wasn’t sure how to proceed. Very grateful.

    @posiwebdesign I’m just newbie at wp, so I made a site specific plugin (you can google how to do this) that way I don’t have to mess with the functions.php
    An expert may know a better way, but that’s what I did to avoid errors and to easily see my customizations. I just pasted what dankfresh shared and it worked beautifully.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Theme preventing Google reCaptcha API from being called, reCaptcha not rendering’ is closed to new replies.