- Timestamp:
- 11/26/2018 04:51:14 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg/functions.php
r7641 r7898 191 191 */ 192 192 function hreflang_link_attributes() { 193 // No hreflangs on 404 pages. 194 if ( is_404() ) { 195 return; 196 } 197 193 198 wp_cache_add_global_groups( array( 'locale-associations' ) ); 194 199 … … 265 270 ); 266 271 272 // Add x-default to the list of sites. 273 $sites['x-default'] = (object) array( 274 'locale' => 'x-default', 275 'hreflang' => 'x-default', 276 'subdomain' => '', 277 ); 278 267 279 uasort( $sites, function( $a, $b ) { 268 280 return strcasecmp( $a->hreflang, $b->hreflang ); … … 270 282 271 283 wp_cache_set( 'local-sites', $sites, 'locale-associations' ); 284 } 285 286 if ( is_singular() ) { 287 $path = parse_url( get_permalink(), PHP_URL_PATH ); 288 } else { 289 // WordPress doesn't have a good way to get the canonical version of non-singular urls. 290 $path = $_SERVER['REQUEST_URI']; // phpcs:ignore 272 291 } 273 292 … … 276 295 'https://%swordpress.org%s', 277 296 $site->subdomain ? "{$site->subdomain}." : '', 278 $ _SERVER['REQUEST_URI'] // phpcs:ignore297 $path 279 298 ); 280 299
Note: See TracChangeset
for help on using the changeset viewer.