Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hide the recaptcha field in a gravity form until the user has started entering text.
<?php
add_action( 'wp_footer', 'ds_gf_footer', 99);
function ds_gf_footer() {
?>
<script>
jQuery(window).load(function() {
jQuery('.gform_wrapper').each(function(){
var recaptcha = jQuery(this).find('.ginput_recaptcha');
if (recaptcha) {
recaptcha.parent().hide();
jQuery(this).find('input, textarea').change(function(){
if (recaptcha.parent().css('display') == 'none')
recaptcha.parent().fadeIn()
})
}
})
});
</script>
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.