Make WordPress Core

Ticket #39006: 39006.diff

File 39006.diff, 2.4 KB (added by diddledani, 10 years ago)

here's an attempt at fixing. I've copied the logic from options-general.php lines 322 thru 327. I'm wondering whether to abstract the logic into a reusable function which both usages call rather than requiring any logic changes to be made in two places.

  • wp-includes/option.php

    diff --git a/wp-includes/option.php b/wp-includes/option.php
    index fa935ce..7ab1e72 100644
    a b function register_initial_settings() {  
    17981798                'description'  => __( 'A day number of the week that the week should start on.' ),
    17991799        ) );
    18001800
    1801         register_setting( 'general', 'WPLANG', array(
    1802                 'show_in_rest' => array(
    1803                         'name' => 'language',
    1804                 ),
    1805                 'type'         => 'string',
    1806                 'description'  => __( 'WordPress locale code.' ),
    1807                 'default'      => 'en_US',
    1808         ) );
     1801        $languages = get_available_languages();
     1802        $translations = wp_get_available_translations();
     1803        if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages ) ) {
     1804                $languages[] = WPLANG;
     1805        }
     1806        if ( ! empty( $languages ) || ! empty( $translations ) ) {
     1807                register_setting( 'general', 'WPLANG', array(
     1808                        'show_in_rest' => array(
     1809                                'name' => 'language',
     1810                        ),
     1811                        'type'         => 'string',
     1812                        'description'  => __( 'WordPress locale code.' ),
     1813                        'default'      => 'en_US',
     1814                ) );
     1815        }
    18091816
    18101817        register_setting( 'writing', 'use_smilies', array(
    18111818                'show_in_rest' => true,