WordPress.org

Make WordPress Core

Ticket #28645: 28645.4.patch

File 28645.4.patch, 995 bytes (added by gauravmittal1995, 7 years ago)

Complete Patch

  • 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 ) {
     331                                define( 'WP_DEFAULT_THEME', $themes->get_stylesheet() );
     332                        } else {
     333                                define( 'WP_DEFAULT_THEME', '' );
     334                        }
     335                }
     336        }
    327337}