At the bottom of the screen, each page displays a third recaptcha icon, which is a bit annoying. In fact, if you read the user agreement, they let you know that the owner of the site is obliged to notify users that data is being collected by Google. In general, if you remove the icon, the user agreement will be violated. Anybody want to sue a monster like that? Of course, it’s unlikely to go to trial, but you never know.
Need help? No problem, email me at: admin@workinnet.ru
Hide reCAPTCHA v3 logo
I’m not gonna scare you, though. There is a way to remove the icon in WordPress . We do the following:
Go to the theme folder. The path is as follows: root folder/site name/wp-content/themes/theme name/. Find the style.css file.
Open it up, go to the end of the file.
We add a few lines of code below.
.grecaptcha-badge { display: none !important; }
What does this code do? It’s simple. Sets the style. The first line is responsible for the name of the style that is assigned to the logo. The second line is responsible for the display output and sets the value to “no, inherit”. Effectively prohibits the logo from being displayed on all pages of the WordPress site.
If we want to display on contact pages, we do it a little differently. Find the id of the pages where the forms are placed. Open the page you want. Press F12 and under the heading <head> find the tag <body>. The id of the page is specified in the class section.
Next, insert the following code into the style.css file:
.page-id-128 .grecaptcha-badge { display: block !important; }
That’s it, the recaptcha works on this page. On others, no. Now suppose you don’t have a few pages, but a few hundred or thousand? It’s a pain in the ass to rewrite the code. We need a different method.
Goodness, it is there and it is more straightforward. To the rescue comes php, which helps to realize all sorts of complexities in a fairly simple way. Go to the function.php file in the theme folder. Go to the end, add the following lines:
//Code removes the recaptcha logo on all pages. remove_action( 'wp_enqueue_scripts', 'wpcf7_recaptcha_enqueue_scripts' ); //Activate the function only on pages with contact forms. if ( function_exists( 'wpcf7_enqueue_scripts' ) ) { add_action( 'wp_enqueue_scripts', 'wpcf7_recaptcha_enqueue_scripts', 10, 0 ); }
All, reCAPTCHA v3 is disabled. Keep in mind, this code only works in WordPress and with the Contact Form 7 plugin.
As a bonus, you can add a feature that allows you to hide the reCAPTCHA v3 icon in WordPress only on certain pages.
function oiw_load_recaptcha_badge_page(){ if ( !is_page( array( 'contact','specify slug' ) ) ) ) { wp_dequeue_script('google-recaptcha'); } } add_action( 'wp_enqueue_scripts', 'oiw_load_recaptcha_badge_page' );
Instead of “specify slug“, use the highlighted part of the url of the desired pages, separated by commas.
That’s it, you’ve hidden the Google reCAPTCHA v3 icon. If you are not using Contact Form 7 , the css codeworks with all kinds of recaptcha. The function, on the other hand, is quite limited and only interacts with the plugin.