How to hide or remove reCAPTCHA badge (V3) from WordPress blog?

The simple code snippet when added into function.php file in WordPress can help in hiding and remove reCAPTCHA badge V3 from all pages, and display only on the contact pages.

Struggling to remove reCAPTCHA badge? Do not worry, we got a quick solution to hide the badge, and also comply with Google policy. Before that, here is the background of what exactly happened with my blog.

I was getting a spammer contact request from WordPress plugin Contact Form 7 to my mailbox. Also most 4-5 contact requests in a day. Most of the spamming was from generic free email addresses like @gmail, @hotmail, @yahoo, etc. for trying out the so-called SEO services, web designing, and, sometimes sign in for explicit content.

I already had a math captcha validation in place, but still, there was no suppression in spammers. I do not know how exactly but somehow they were able to bypass the validation and hit the email to my mailbox. Look at the below sample:

Spam email contact request example

Fortunately, in Contact Form 7 plugin the developer had added an option to enable the Google reCAPTCHA validation for these spam protection. All you need is to sign up your website into Google reCAPTCHA V3 and get the API keys to input in Contact Form 7 integration.

Yes – after integration the spam mailers have minimized significantly but, it started another problem of displaying the reCAPTCHA badge on all blog posts and pages.

reCAPTCHA on Contact restoreBin
It makes sense to display this badge only on the Contact form or the page where the validation is actually being used, but the badge was appearing all over the website and even on the home page.

When I checked in mobile, the reCAPTCHA badge was covering and floating at the bottom section making the content invisible. I personally consider this as a bad user experience.

However, after looking out for solutions and reading some threads on their policy, I found that we need to display the reCAPTCHA badge at least on the page where the validation is actually used. Which means I can remove reCAPTCHA badge from all other pages and post except the Contact page.

remove reCAPTCHA Badge WordPress

remove reCAPTCHA Badge V3

I added a small piece of code and customized it to make sure that badge is only appearing on the contact page and nowhere else on site. Add the below code in your WordPress function.php file at the end.

function restorebin_load_recaptcha_badge_page(){
if ( !is_page( array( 'contact') ) ) {
wp_dequeue_script('google-recaptcha');
}
}
add_action( 'wp_enqueue_scripts', 'restorebin_load_recaptcha_badge_page' );

Just in case if you use the validation on any other page apart from contact, just customize to add the slug_url of the page and append as below.

function restorebin_load_recaptcha_badge_page(){
if ( !is_page( array( 'contact', 'slug_url1','slug_url2') ) ) {
wp_dequeue_script('google-recaptcha');
}
}
add_action( 'wp_enqueue_scripts', 'restorebin_load_recaptcha_badge_page' );

The above code will hide and remove the reCAPTCHA badge on all other pages except the one mentioned.
There are some other snippets available online which will probably hide reCAPTCHA badge from displaying. Like for example:

.grecaptcha-badge {
display: none;
}

When this code snippet is added into your CSS file, it will hide the reCAPTCHA V3 badge from appearing, but in backend still loads the JS scripts henceforth increasing the render time. Hence, I recommend the earlier mentioned wp_dequeue_script snippet will be the best possible solution not hampering the overall site load in any way.

If you've any thoughts on How to hide or remove reCAPTCHA badge (V3) from WordPress blog?, then feel free to drop in below comment box. Cheers!

Share
Kushal Azza
Kushal Azza
Fond of latest technologies and gadgets. I'm a digital dev and analytics consultant. Also, the geek behind this blog!

Leave a Reply

Your email address will not be published. Required fields are marked *