}
add_filter( 'woocommerce_checkout_fields' , 'custom_wc_checkout_fields' );
+
+// Dissable captch if it has been solved once using session
+// safely start a session
+function my_session_start( ) {
+ $sid = session_id();
+ if ( empty( $sid ) ) {
+ session_start();
+ }
+}
+add_action('init','my_session_start',1);
+
+// don't requiere captcha, if session says so
+function my_wp_recaptcha_required( $is_required ) {
+ if ( isset( $_SESSION['recaptcha_solved'] ) && $_SESSION['recaptcha_solved'] )
+ return false;
+ return $is_required;
+}
+add_filter('wp_recaptcha_required' , 'my_wp_recaptcha_required');
+
+// store in session if captcha solved
+function my_wp_recaptcha_checked( $check_successful ) {
+ if ( $check_successful )
+ $_SESSION['recaptcha_solved'] = true;
+}
+add_action('wp_recaptcha_checked','my_wp_recaptcha_checked');
+
?>