WordPress.org

Make WordPress Core

Ticket #20313: get_theme_data-subdirs-fix.diff

File get_theme_data-subdirs-fix.diff, 761 bytes (added by westi, 7 years ago)

Fix to the logic in get_theme_data to correctly determine the theme slug and root to create a correct WP_Theme object.

  • wp-includes/deprecated.php

     
    30713071 */
    30723072function get_theme_data( $theme_file ) {
    30733073        _deprecated_function( __FUNCTION__, 3.4, 'wp_get_theme()' );
    3074         $theme = new WP_Theme( basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) );
     3074        $theme_root = trailingslashit( get_theme_root( $theme_file ) );
     3075        $theme_slug = str_replace( $theme_root, '', dirname( $theme_file ) );
     3076        $theme = new WP_Theme( $theme_slug, $theme_root );
    30753077
    30763078        $theme_data = array(
    30773079                'Name' => $theme->get('Name'),
     
    30883090        );
    30893091
    30903092        return $theme_data;
    3091 }
    3092  No newline at end of file
     3093}