language_attributes()WP 2.1.0

Displays the language attributes for the 'html' tag.

Builds up a set of HTML attributes containing the text direction and language information for the page.

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

No Hooks.

Return

null. Nothing (null).

Usage

language_attributes( $doctype );
$doctype(string)
The type of HTML document. Accepts 'xhtml' or 'html'.
Default: 'html'

Examples

0

#1 What language_attributes() outputs

If you have a site in Russian, then:

language_attributes();

// output: lang="ru-RU"
0

#2 How to use in code

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

Changelog

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

language_attributes() code WP 6.5.3

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