get_language_attributes()
Gets the language attributes for the <html> tag.
It generates:
dir="rtl"for right-to-left languages.lang="..."for the HTML document.xml:lang="..."for an XHTML document.
The language is determined through get_bloginfo() with the language parameter. The resulting string can be changed with the language_attributes filter.
Use language_attributes() to output the attributes.
Used By: language_attributes()
1 time — 0.0018239 sec (very slow) | 50000 times — 0.40 sec (very fast)
Hooks from the function
Returns
String.
string- attributes separated by spaces.''- if no attribute was generated.
Usage
get_language_attributes( $doctype );
- $doctype(string)
Document type:
htmlorxhtml.Default:
html
Examples
#1 Getting language attributes
$attributes = get_language_attributes(); echo '<html ' . $attributes . '>';
For a Russian-language site, this will result in:
<html lang="ru-RU">
For a language with right-to-left writing direction:
<html dir="rtl" lang="ar">
Changelog
| Since 4.3.0 | Introduced. |