duankang5285 2017-02-17 00:38
浏览 70
已采纳

Recaptcha联系表格7和Mailchimp表格在一页WP

Hi I have 2 forms on one page. Contact form 7 and a Mailchimp form

Mailchimp form recaptcha does not work because I think it is appearing twice:

Contact Form 7

<script type="text/javascript" async src="https://www.gstatic.com/recaptcha/api2/r20170213115309/recaptcha__en.js"></script>

Mailchimp form

<script type="text/javascript" async src="https://www.gstatic.com/recaptcha/api2/r20170213115309/recaptcha__en.js"></script>

Errors in console:

Uncaught Error: ReCAPTCHA placeholder element must be empty

On pages without contact form 7 the Mailchimp recaptcha works fine.

Any ideas? do I have to deregister the contact form 7 script in functions file? Or can I do with jquery?

  • 写回答

2条回答 默认 最新

  • douhui5953 2017-02-21 23:05
    关注

    I managed a hack workaround.

    By loading recaptcha on all pages except the contact form page so contact form 7 and mailchimp share same script and not load twice. I added this to the head.php in WP

    if( !is_page( array( 'contact-australia',))){ ?>
        <script src="https://www.google.com/recaptcha/api.js" async ></script>
    <?php } ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?