Skip to content

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

Integrating Google reCAPTCHA with Contact Form 7 will enable the reCAPTCHA badge on all the pages on WordPress site. However we can use a simple PHP code in the function.php file to hide the reCAPTCHA badge from appearing on all pages. We can enable the reCAPTCHA only on the required pages where the spam protection is used.

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

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

I already had a math captcha validation in place, but still, there was no suppression of 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 this spam protection. All you need is to sign up for 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 the badge only on the Contact form or the page where the validation is used. But the badge appeared all over the website and 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 consider this a bad user experience.

However, after looking 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 used. It means I can remove the reCAPTCHA badge from all other pages and post except the Contact page.

remove reCAPTCHA Badge WordPress

Remove reCAPTCHA Badge

I added a trim code and customized it to ensure that the badge only appears 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 you use the validation on any other page like Advertise, etc., apart from contact, 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.

Some other snippets available online will probably hide the reCAPTCHA badge from displaying. For example:

.grecaptcha-badge {
display: none;
}

When this code snippet is added to your CSS file, it will hide the reCAPTCHA V3 badge from appearing, but the backend still loads the JS scripts, subsequently 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.

F.A.Q: Hide reCAPTCHA Badge

We have listed the frequently asked questions related to hiding the reCAPTCHA logo from WordPress on all pages:

How to remove the Google reCAPTCHA badge from WordPress pages?

We can remove the Google reCAPTCHA badge from the WordPress page using a small snippet of code in the function.php file that will hide the capture logo from all the pages.

Can we hide Google reCAPTCHA on the website homepage?

If we declare the homepage in the wp_dequeue_script rule that executes the Google reCAPTCHA, it will automatically hide the reCAPTCHA logo from the homepage.

Can we enable Google reCAPTCHA only on the contact page?

We can enable the Google reCAPTCHA script to execute on certain pages like the contact form page using the function.php file in WordPress.

3 thoughts on “How to hide or remove reCAPTCHA badge (V3) from WP?”

Leave a Reply

Your email address will not be published.