diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 55f43cbe31..5d32afa578 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -6381,8 +6381,10 @@ function wp_timezone_choice( $selected_zone, $locale = null ) { $mo_loaded = true; } - $zonen = array(); - foreach ( timezone_identifiers_list() as $zone ) { + $tz_identifiers = timezone_identifiers_list(); + $zonen = array(); + + foreach ( $tz_identifiers as $zone ) { $zone = explode( '/', $zone ); if ( ! in_array( $zone[0], $continents, true ) ) { continue; @@ -6417,6 +6419,13 @@ function wp_timezone_choice( $selected_zone, $locale = null ) { $structure[] = ''; } + // If this is a deprecated, but valid, timezone string, display it at the top of the list as-is. + if ( in_array( $selected_zone, $tz_identifiers, true ) === false + && in_array( $selected_zone, timezone_identifiers_list( DateTimeZone::ALL_WITH_BC ), true ) + ) { + $structure[] = ''; + } + foreach ( $zonen as $key => $zone ) { // Build value in an array to join later. $value = array( $zone['continent'] );