Making WordPress.org


Ignore:
Timestamp:
10/15/2019 06:53:44 AM (7 years ago)
Author:
dd32
Message:

WordPress.org, Plugin Directory, and Theme Directory: Sync the hreflang tag implementations. This prevents linking to non-existent sites.

Fixes #4713.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php

    r9013 r9180  
    836836                wp_cache_add_global_groups( array( 'locale-associations' ) );
    837837
     838                // Google doesn't have support for a whole lot of languages and throws errors about it,
     839                // so we exclude them, as we're otherwise outputting data that isn't used at all.
     840                $unsupported_languages = array(
     841                        'arq',
     842                        'art',
     843                        'art-xemoji',
     844                        'ary',
     845                        'ast',
     846                        'az-ir',
     847                        'azb',
     848                        'bcc',
     849                        'ff-sn',
     850                        'frp',
     851                        'fuc',
     852                        'fur',
     853                        'haz',
     854                        'ido',
     855                        'io',
     856                        'kab',
     857                        'li',
     858                        'li-nl',
     859                        'lmo',
     860                        'me',
     861                        'me-me',
     862                        'rhg',
     863                        'rup',
     864                        'sah',
     865                        'sc-it',
     866                        'scn',
     867                        'skr',
     868                        'srd',
     869                        'szl',
     870                        'tah',
     871                        'twd',
     872                        'ty-tj',
     873                        'tzm',
     874                );
     875
    838876                // WARNING: for any changes below, check other uses of the `locale-assosciations` group as there's shared cache keys in use.
    839877                $cache_key = $post ? 'local-sites-' . $post->post_name : 'local-sites';
    … …  
    863901                                }
    864902
     903                                // Skip unsupported locales.
     904                                if ( in_array( $gp_locale->slug, $unsupported_languages ) ) {
     905                                        unset( $sites[ $key ] );
     906                                        continue;
     907                                }
     908
    865909                                $sites[ $key ]->subdomain = $subdomains[ $site->wp_locale ]->subdomain;
     910
     911                                // Skip non-existing subdomains, e.g. 'de_CH_informal'.
     912                                if ( false !== strpos( $site->subdomain, '_' ) ) {
     913                                        unset( $sites[ $key ] );
     914                                        continue;
     915                                }
    866916
    867917                                // Note that Google only supports ISO 639-1 codes.
Note: See TracChangeset for help on using the changeset viewer.