UPDATE: I can also hide via CSS like this:
.grecaptcha-badge {
opacity: 0;
}
I stumbled into a situation where I needed to ENABLE captcha on Woocommerce product page(s) and I couldn’t find a workaround using the code below – which still works as intended… This updated code is much better at limiting the reCAPTCHA scripts by looking for CF7 shortcode!
add_action( 'wp_enqueue_scripts', 'custom_load_contact_form_resources', 1 );
function custom_load_contact_form_resources() {
global $post;
if ( isset( $post ) && has_shortcode( $post->post_content, 'contact-form-7' ) ) {
return;
}
remove_action( 'wp_enqueue_scripts', 'wpcf7_do_enqueue_scripts' );
remove_action( 'wp_enqueue_scripts', 'wpcf7_recaptcha_enqueue_scripts' );
}
I recently ran into a problem with Contact 7 where excessive spam was coming from our forms. The reCAPTCHA system works great, but includes an annoying albeit lawful little mention that started showing up on ALL pages. This solution will eliminate the mention on pages other than the page in question.
function oiw_load_recaptcha_badge_page(){
if ( !is_page( array( 'contact','other_pages' ) ) ) {
wp_dequeue_script('google-recaptcha');
}
}
add_action( 'wp_enqueue_scripts', 'oiw_load_recaptcha_badge_page' );