Forum Replies Created

Viewing 1 replies (of 1 total)
  • dodaxas

    (@dodaxas)

    Just use FILTER to modify LANG attribute OUTPUT

    function modify_language_attributes_defaults($output, $doctype) {
    
        // Check if WPML is active
        if (function_exists('icl_object_id')) {
    
            // Get the current language code
    
             $current_language = apply_filters('wpml_current_language', NULL);
    
            switch ($current_language) {
    
                case 'en':
    
                    $output = str_replace('en-US', 'en', $output);
    
                    break;
    
                case 'lt':
    
                    $output = str_replace('lt-LT', 'lt', $output);
    
                    break;
    
                case 'ru':
    
                    $output = str_replace('ru-RU', 'ru', $output);
    
                     break;
    
             }
    
        }
    
        return $output;
    }
    
    // add the filter
    add_filter( "language_attributes", "modify_language_attributes_defaults", 10, 2 );
Viewing 1 replies (of 1 total)