Last active
September 5, 2018 19:30
-
-
Save webdevsuperfast/e17c3f14fc17e029c95072f657b68704 to your computer and use it in GitHub Desktop.
Disable Gravity Forms Captcha on Mobile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter( 'gform_pre_render', 'disable_captcha' ); | |
| add_filter( 'gform_pre_validation', 'disable_captcha' ); | |
| // add_filter( 'gform_pre_validation', 'disable_captcha' ); | |
| // add_filter( 'gform_admin_pre_render', 'disable_captcha' ); | |
| add_filter( 'gform_pre_submission_filter', 'disable_captcha' ); | |
| function disable_captcha( $form ) { | |
| foreach( $form['fields'] as $key => $field ) { | |
| if ( $field->type === 'captcha' && wp_is_mobile() ) { | |
| unset( $form['fields'][$key] ); | |
| } | |
| } | |
| return $form; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment