This lightweight SEO plugin for WordPress allows changing the default HTML lang attribute globally, and on individual Posts and Pages. Along with cross-referencing similar Posts/Pages in different Languages using Alternate Hreflang tags.
The Plugin is mostly of use when your WordPress blog contains a mix of languages with individual Posts/Pages, and you do not want to install a huge translation plugin (because your posts are not actually translations, but just each individually published in a different content language). Accordingly you may also not want to change any of the URLs of your existing articles.
- Allows changing the default HTML lang attribute for your Blog,
- overwriting the HTML lang attribute on individual Posts and Pages (in addition to 1.),
- and cross-referencing Posts/Pages in different languages using Alternate Hreflang tags.
I developed this because my Blog is mostly written in English, but contains some articels written in German - of which some have gotten a content recycle across the two languages. And I wanted to improve their respective search engine optimization. In addition, with this plugin, I was able to change the default "English (United States)" (en-US
) language code to just neutral "English" (en
).
- Download the Plugin
- Place the unzipped
language-locale-overwrite
-folder into your WordPress Plugin directory:[wordpress]/wp-content/plugins/
- Go to your WordPress Admin Dashboard » Plugins, and activate «Language Locale Overwrite»
- Go to your WordPress "Settings » General" at /wp-admin/options-general.php#llo_global
- Set your desired ISO-Language/-Country locale using the setting «Change HTML lang attribute»
- (Optional) For OpenGraph
og:locale
you can set a preferred 2-char country code using «Custom Country code»
- Open any Post or Page, for which you want to modify its language locale
- There's a new section «Language Locale» where a valid ISO-Language/-Country code can be specified
Pre-requisite: you must have Post/Pages already tagged with a "non-default" language locale!
- Edit the Post or Page, for which you want to reference a translated Post/Page
- In the «Language Locale» section, use the «Link alternate lang…»-dropdowns to make cross-links
Valid language locales either consist of 2-characters ISO-code for languages, or a combination thereof with a 2-characters ISO country code. Here are some examples:
de
→ Germande-DE
→ Germany (German)de-CH
→ Switzerland (German)en
→ Englishen-GB
→ United Kingdom (English)fr
→ Frenchzh-CN
→ Chinese (Simplified)- …and so on