language_attributes()WP 2.1.0

Outputs attributes for the HTML tag <html> with the values of the current language: lang="ru-RU"

Builds a set of attributes for the HTML tag <html> HTML, containing the name of the site's language and the reading direction for the page.

1 time — 0.000125 sec (fast) | 50000 times — 2.85 sec (fast)

No Hooks.

Returns

null. Nothing. Outputs a string to the screen.

Usage

<html <?php language_attributes(); ?>>
$doctype(string)
Type of the HTML document: xhtml or html.
Default: 'html'

Examples

1

#1 How to use in code

<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
...
0

#2 What language_attributes() outputs

If you have a site in Russian, then:

language_attributes();

// output: lang="ru-RU"

Changelog

Since 2.1.0 Introduced.
Since 4.3.0 Converted into a wrapper for get_language_attributes().

language_attributes() code WP 6.9.1

function language_attributes( $doctype = 'html' ) {
	echo get_language_attributes( $doctype );
}