WordPress.org

Make WordPress Core

Ticket #28645: 28645.2.patch

File 28645.2.patch, 986 bytes (added by gauravmittal1995, 7 years ago)

Changed to adjust the empty array (No themes)

  • wp-includes/default-constants.php

     
    319319         * Slug of the default theme for this install.
    320320         * Used as the default theme when installing new sites.
    321321         * Will be used as the fallback if the current theme doesn't exist.
     322         * Will use the latest theme if available, else the first theme which is returned by wp_get_themes().
    322323         * @since 3.0.0
    323324         */
    324         if ( !defined('WP_DEFAULT_THEME') )
    325                 define( 'WP_DEFAULT_THEME', 'twentyfourteen' );
    326 
     325        if ( !defined('WP_DEFAULT_THEME') ) {
     326                if ( wp_get_theme('twentyfourteen')->exists() )                 
     327                        define( 'WP_DEFAULT_THEME', 'twentyfourteen' );
     328                else {
     329                        $themes = reset(wp_get_themes());
     330                        if ( $themes != false )
     331                                define( 'WP_DEFAULT_THEME', $themes->get_stylesheet() );
     332                        else
     333                                define( 'WP_DEFAULT_THEME', '' );
     334                }
     335        }
    327336}