【问题标题】:reCAPTCHA not working in popup contact form 7reCAPTCHA 在弹出式联系表格 7 中不起作用
【发布时间】:2017-11-16 02:35:52
【问题描述】:

recaptcha 在我的联系页面中运行良好。但是弹出窗口中还有其他两种形式。在那个recaptcha没有显示。<div class="g-recaptcha" data-sitekey="***********************"></div>

【问题讨论】:

  • 您能否提供更多详细信息?
  • 我已经集成了站点密钥和密钥。它在我的联系页面中工作正常。但它没有显示在弹出窗口中打开的表单中。
  • 能否提供网站链接,以便我查看。
  • 弹窗打开时有没有检查JS错误

标签: wordpress contact-form-7 recaptcha


【解决方案1】:

这可能不是您的问题,但请仔细检查以确保相关页面正在加载 Google reCAPTCHA JS(撰写本文时为https://www.google.com/recaptcha/api.js)。

在我的情况下(使用 Magnific Popup,顺便说一句),Google reCAPTCHA JS 脚本没有加载到显示问题的页面上。 Contact From 7 reCAPTCHA plugin 中的这段代码出现故障,是问题的根源:

function wp_footer()
{
    if( count( $this->ids ) )
    {
        wp_print_scripts('contact_form_7_recaptcha_script');
    }
}

我注释掉了if()声明:

function wp_footer()
{
    // Commented out to ensure that the JS is always loaded, regardless of the value of `$this->ids`.
    // if( count( $this->ids ) )
    // {
        wp_print_scripts('contact_form_7_recaptcha_script');
    // }
}

现在,reCAPTCHA JS 总是被加载,reCAPTCHA 元素出现在弹出窗口中我的联系表单中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-10-04
    • 2017-08-29
    • 2017-01-23
    • 1970-01-01
    • 2018-02-24
    • 1970-01-01
    • 2022-10-06
    相关资源
    最近更新 更多