Home » Tutorial » Change HTML Language In WordPress

Change HTML Language In WordPress

WordPress Site Language

HTML Language value is a declaration of which language you are using for the website. If you go to your WordPress website page source you will see the default settings is <htmllang=”en-US” >.

default-html-language-wordpress

If you are using different language for your website, you may need to change this value. But if you don’t, it’s not a big deal. Google ignore this value. But for the best practice, you can change it from your website’s dashboard. Go to Settings>General and change the Site Language, and then click Save Changes.

WordPress Site Language

If your desired language is available in the list, WordPress will install it automatically after you click Save Changes. All done! Now refresh your page and check the source code. You will see that the value has changed.

The Other Way

The above method is great. But it will change the language of the dashboard too. If you want to change the html language value for your website but you want to keep your dashboard in English, then copy and paste following code in your theme’s functions.php

add_filter('language_attributes', 'custom_lang_attr');
function custom_lang_attr() {
  return 'lang="bn-BD"';
}

Change bn-BD to your language.

Read more from Tutorial

Written by:

Morshed Alam
A teacher by profession, a traveler by passion and a netizen by choice.

Have you written on ThoughtMight?Write Today



Leave a Comment

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