Making WordPress.org


Ignore:
Timestamp:
08/30/2018 09:38:50 AM (8 years ago)
Author:
SergeyBiryukov
Message:

WP.org: Don't output hreflang link attributes for languages Google does not support.

Props joostdevalk.
Fixes #3782.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg/functions.php

    r7428 r7641  
    193193        wp_cache_add_global_groups( array( 'locale-associations' ) );
    194194
     195        // Google doesn't have support for a whole lot of languages and throws errors about it,
     196        // so we exclude them, as we're otherwise outputting data that isn't used at all.
     197        $unsupported_languages = array(
     198                'arq',
     199                'art',
     200                'art-xemoji',
     201                'ary',
     202                'ast',
     203                'az-ir',
     204                'azb',
     205                'bcc',
     206                'ff-sn',
     207                'frp',
     208                'fuc',
     209                'fur',
     210                'haz',
     211                'ido',
     212                'io',
     213                'kab',
     214                'li',
     215                'li-nl',
     216                'lmo',
     217                'me',
     218                'me-me',
     219                'rhg',
     220                'rup',
     221                'sah',
     222                'sc-it',
     223                'scn',
     224                'skr',
     225                'srd',
     226                'szl',
     227                'tah',
     228                'twd',
     229                'ty-tj',
     230                'tzm',
     231        );
     232
    195233        $sites = wp_cache_get( 'local-sites', 'locale-associations' );
    196234
    … …  
    213251                        }
    214252
    215                         if ( isset( $gp_locale->slug ) ) {
     253                        if ( isset( $gp_locale->slug ) && ! in_array( $gp_locale->slug, $unsupported_languages ) ) {
    216254                                $sites[ $site->locale ]->hreflang = $gp_locale->slug;
    217255                        } else {
Note: See TracChangeset for help on using the changeset viewer.