// Add reCaptcha JavaScript function wpp_login_script() { wp_register_script('login-recaptcha', 'https://www.google.com/recaptcha/api.js', false, NULL); wp_enqueue_script('login-recaptcha'); } add_action('login_enqueue_scripts', 'wpp_login_script'); // Add reCaptcha on login page function add_recaptcha_on_login_page() { echo '
'; } add_action('login_form','add_recaptcha_on_login_page'); // Validating reCaptcha function captcha_login_check($user, $password) { if (!empty($_POST['g-recaptcha-response'])) { $secret = '6Lel21gqAAAAAPQKN0hASwsMVLhO-KSl3gkaZsBG'; $ip = $_SERVER['REMOTE_ADDR']; $captcha = $_POST['g-recaptcha-response']; $rsp = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . $secret . '&response=' . $captcha .'&remoteip='. $ip); $valid = json_decode($rsp, true); if ($valid["success"] == true) { return $user; } else { return new WP_Error('Captcha Invalid', __('
Captcha Invalid! Please check the captcha!
')); } } else { return new WP_Error('Captcha Invalid', __('
Captcha Invalid! Please check the captcha!
')); } } add_action('wp_authenticate_user', 'captcha_login_check', 10, 2); SIMAK UI 2014 - Clavius

SIMAK UI 2014