Hide button on excluded page
Since the version 3.5 of Weglot plugin, the button is visible even is the page is excluded. Here is how to hide it on excluded page
For example imagine we ecluded /fr/contact:
The button will be visible on /contact and on /fr/contact
To hide button on excluded page:
1
// Add this using plugin "Code Snippet" or directly in functions.php
2
add_filter( 'weglot_button_html', 'weglot_button_hide', 10 , 3);
3
4
function weglot_button_hide($html, $classes) {
5
$show_button = weglot_get_service("Request_Url_Service_Weglot")->is_eligible_url(weglot_get_current_full_url());
6
if(!$show_button) {
7
return "";
8
}
9
return $html;
10
}
Copied!
Last modified 1mo ago
Copy link