Changeset 30697
- Timestamp:
- 12/02/2014 02:20:14 AM (10 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/theme.php
r30680 r30697 425 425 WP_Theme::sort_by_name( $themes ); 426 426 foreach ( $themes as $theme ) { 427 $slug = $theme->get_stylesheet(); 428 $encoded_slug = urlencode( $slug ); 429 427 430 $parent = false; 428 431 if ( $theme->parent() ) { 429 432 $parent = $theme->parent()->display( 'Name' ); 430 } 431 432 $slug = $theme->get_stylesheet(); 433 $encoded_slug = urlencode( $slug ); 433 $parents[ $slug ] = $theme->parent()->get_stylesheet(); 434 } 434 435 435 436 $prepared_themes[ $slug ] = array( … … 461 462 } 462 463 464 // Remove 'delete' action if theme has an active child 465 if ( isset( $parents ) && array_key_exists( $current_theme, $parents ) ) { 466 unset( $prepared_themes[ $parents[ $current_theme ] ]['actions']['delete'] ); 467 } 468 463 469 /** 464 470 * Filter the themes prepared for JavaScript, for themes.php. -
trunk/src/wp-admin/themes.php
r30356 r30697 27 27 if ( !current_user_can('delete_themes') || ! $theme->exists() ) 28 28 wp_die( __( 'Cheatin’ uh?' ), 403 ); 29 delete_theme($_GET['stylesheet']); 30 wp_redirect( admin_url('themes.php?deleted=true') ); 29 $active = wp_get_theme(); 30 if ( $active->get( 'Template' ) == $_GET['stylesheet'] ) { 31 wp_redirect( admin_url( 'themes.php?delete-active-child=true' ) ); 32 } else { 33 delete_theme( $_GET['stylesheet'] ); 34 wp_redirect( admin_url( 'themes.php?deleted=true' ) ); 35 } 31 36 exit; 32 37 } … … 134 139 elseif ( isset($_GET['deleted']) ) : ?> 135 140 <div id="message3" class="updated"><p><?php _e('Theme deleted.') ?></p></div> 141 <?php elseif ( isset( $_GET['delete-active-child'] ) ) : ?> 142 <div id="message4" class="error"><p><?php _e( 'You cannot delete a theme while it has an active child theme.' ); ?></p></div> 136 143 <?php 137 144 endif;
Note: See TracChangeset
for help on using the changeset viewer.