• Add this code into the php file

    add_action('wp_print_scripts', 'ninja_recaptcha_register_scripts');
    function ninja_recaptcha_register_scripts() {
        wp_register_script('ninja.g.recaptcha', "https://www.google.com/recaptcha/api.js?onload=CaptchaCallback&render=explicit&hl");
    	wp_register_script('ninja.g.recaptcha.script', plugins_url('/ninja-forms-recaptcha-field/js/script.js'));
    
        wp_enqueue_script('jquery');
        wp_enqueue_script('ninja.g.recaptcha');
        wp_enqueue_script('ninja.g.recaptcha.script');
    }

    js code

    var CaptchaCallback;
    $(document).ready(function(){
    	CaptchaCallback = function(){
    			$('.g-recaptcha').each(function(index,ele){
    				grecaptcha.render(ele, {
    					'sitekey' : XXXXXXXXXXXXXXXXXXXXXXXXX;,
    					'callback' : $(this).attr('data-callback')
    				});
    			});
    		}
    });

    And Please remove the following code
    api.js script include in ninja_forms_recaptcha_display function
    Add id to every .g-recaptcha

  • The topic ‘Edit for multi form in one page with recaptcha’ is closed to new replies.