Reputation: 19097
I have been researching a problem that I have and came across this discussion:
https://gtranslate.io/forum/how-not-translate-the-title-meta-tag-t4852.html
In there the answer provided is to use this html syntax:
<title class="notranslate">Example</title>
The issue at hand is to prevent Google Translate from translating the <title>
tag. What I have is a WordPress website:
I don't know how to go about changing the site to apply this syntax for all the <title>
tags on my posts and pages. I read up about wp_head()
but am getting lost.
Any advice appreciated.
The header.php
for the theme I am using has this code:
<?php wp_head(); ?>
<?php if ( get_option('google_analitic_code') ) : ?>
<?php echo get_option('google_analitic_code'); ?>
<?php endif; ?>
</head>
Upvotes: 0
Views: 1237
Reputation: 6555
Add Below function in function.php
remove_action( 'wp_head', '_wp_render_title_tag', 1 );
Add Below code in header.php befode wp_head();
<title class="notranslate"><?php bloginfo('name');?> | <?php wp_title();?></title>
Hope this works for you.
Upvotes: 1