WordPress.org

Make WordPress Core

Ticket #28645: 28645.patch

File 28645.patch, 931 bytes (added by gauravmittal1995, 7 years ago)

Checks for the latest theme, If doesnt exist then uses the first available theme.

  • 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 = wp_get_themes();
     330                        $themes = reset($themes);
     331                        define( 'WP_DEFAULT_THEME', $themes->get_stylesheet() );
     332                }
     333        }
    327334}