The key secret’s right, however it returns 0 and it would not appear to work correctly, what must be mounted or redone?
PHP code:
// add_recaptcha_api
add_action( ‘wp_enqueue_scripts’, ‘add_recaptcha_api’, 11 );
perform add_recaptcha_api() {
wp_deregister_script( ‘add_recaptcha_api’ );
wp_register_script( ‘add_recaptcha_api’, ‘https://www.google.com/recaptcha/api.js?render=6LdwamUbAAAAAJE-IEtIOT9VrbKSFi7U7Sfj62KR’);
wp_enqueue_script( ‘add_recaptcha_api’ );
}
perform registration_recaptcha(){
$recaptcha_url="https://www.google.com/recaptcha/api/siteverify";
$recaptcha_secret="secret";
$recaptcha_response = $_POST['recaptcha_response'];
$recaptcha = file_get_contents($recaptcha_url . '?secret=" . $recaptcha_secret . "&response=" . $recaptcha_response);
$recaptcha = json_decode($recaptcha);
if ($recaptcha->success == true && $recaptcha->rating >= 0.5 && $recaptcha->motion == “registration_recaptcha’) {
}
else
{
}
}
add_action( “wp_ajax_nopriv_registration_recaptcha”, “registration_recaptcha” );
JS code: