get_language_attributes

The timeline below displays how wordpress function get_language_attributes has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Gets the language attributes for the 'html' tag.
 *
 * Builds up a set of HTML attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of HTML document. Accepts 'xhtml' or 'html'. Default 'html'.
 * @return string A space-separated list of language attributes.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    $lang = get_bloginfo('language');
    if ($lang) {
        if ('text/html' === get_option('html_type') || 'html' === $doctype) {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if ('text/html' !== get_option('html_type') || 'xhtml' === $doctype) {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filters the language attributes for display in the 'html' tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of HTML document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 5.5

/**
 * Gets the language attributes for the 'html' tag.
 *
 * Builds up a set of HTML attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of HTML document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    $lang = get_bloginfo('language');
    if ($lang) {
        if ('text/html' === get_option('html_type') || 'html' === $doctype) {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if ('text/html' !== get_option('html_type') || 'xhtml' === $doctype) {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filters the language attributes for display in the 'html' tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of HTML document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 5.4

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    $lang = get_bloginfo('language');
    if ($lang) {
        if ('text/html' === get_option('html_type') || 'html' === $doctype) {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if ('text/html' !== get_option('html_type') || 'xhtml' === $doctype) {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filters the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 5.3

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    $lang = get_bloginfo('language');
    if ($lang) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filters the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 9.1

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filters the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 4.9

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = "lang=\"{$lang}\"";
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = "xml:lang=\"{$lang}\"";
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filters the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 8.4

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filters the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 8.2

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = "lang=\"{$lang}\"";
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = "xml:lang=\"{$lang}\"";
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filters the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: .10

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filters the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 4.7

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = "lang=\"{$lang}\"";
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = "xml:lang=\"{$lang}\"";
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filters the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 6.9

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filters the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 6.3

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = "lang=\"{$lang}\"";
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = "xml:lang=\"{$lang}\"";
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filters the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: .20

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filters the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 6.2

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = "lang=\"{$lang}\"";
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = "xml:lang=\"{$lang}\"";
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filters the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: .10

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filters the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 4.6

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = "lang=\"{$lang}\"";
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = "xml:lang=\"{$lang}\"";
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filters the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 5.4

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = "lang=\"{$lang}\"";
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = "xml:lang=\"{$lang}\"";
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: .30

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 5.3

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = "lang=\"{$lang}\"";
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = "xml:lang=\"{$lang}\"";
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: .20

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 5.2

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = "lang=\"{$lang}\"";
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = "xml:lang=\"{$lang}\"";
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: .12

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 4.4

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = "lang=\"{$lang}\"";
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = "xml:lang=\"{$lang}\"";
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: .30

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 4.3

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = "lang=\"{$lang}\"";
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = "xml:lang=\"{$lang}\"";
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: .20

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 4.2

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = "lang=\"{$lang}\"";
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = "xml:lang=\"{$lang}\"";
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: .13

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 3.4

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = "lang=\"{$lang}\"";
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = "xml:lang=\"{$lang}\"";
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: .30

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 3.3

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = "lang=\"{$lang}\"";
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = "xml:lang=\"{$lang}\"";
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: .20

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 3.2

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = "lang=\"{$lang}\"";
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = "xml:lang=\"{$lang}\"";
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: .14

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = 'lang="' . esc_attr($lang) . '"';
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = 'xml:lang="' . esc_attr($lang) . '"';
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}

WordPress Version: 4.3

/**
 * Gets the language attributes for the html tag.
 *
 * Builds up a set of html attributes containing the text direction and language
 * information for the page.
 *
 * @since 4.3.0
 *
 * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
 */
function get_language_attributes($doctype = 'html')
{
    $attributes = array();
    if (function_exists('is_rtl') && is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }
    if ($lang = get_bloginfo('language')) {
        if (get_option('html_type') == 'text/html' || $doctype == 'html') {
            $attributes[] = "lang=\"{$lang}\"";
        }
        if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') {
            $attributes[] = "xml:lang=\"{$lang}\"";
        }
    }
    $output = implode(' ', $attributes);
    /**
     * Filter the language attributes for display in the html tag.
     *
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     *
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
     */
    return apply_filters('language_attributes', $output, $doctype);
}