mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Prevent the deletion of a theme while it has an active child theme.
Fixes #29580 Props karpstrucking, jesin git-svn-id: https://develop.svn.wordpress.org/trunk@30697 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -424,14 +424,15 @@ function wp_prepare_themes_for_js( $themes = null ) {
|
||||
|
||||
WP_Theme::sort_by_name( $themes );
|
||||
foreach ( $themes as $theme ) {
|
||||
$slug = $theme->get_stylesheet();
|
||||
$encoded_slug = urlencode( $slug );
|
||||
|
||||
$parent = false;
|
||||
if ( $theme->parent() ) {
|
||||
$parent = $theme->parent()->display( 'Name' );
|
||||
$parents[ $slug ] = $theme->parent()->get_stylesheet();
|
||||
}
|
||||
|
||||
$slug = $theme->get_stylesheet();
|
||||
$encoded_slug = urlencode( $slug );
|
||||
|
||||
$prepared_themes[ $slug ] = array(
|
||||
'id' => $slug,
|
||||
'name' => $theme->display( 'Name' ),
|
||||
@@ -460,6 +461,11 @@ function wp_prepare_themes_for_js( $themes = null ) {
|
||||
);
|
||||
}
|
||||
|
||||
// Remove 'delete' action if theme has an active child
|
||||
if ( isset( $parents ) && array_key_exists( $current_theme, $parents ) ) {
|
||||
unset( $prepared_themes[ $parents[ $current_theme ] ]['actions']['delete'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the themes prepared for JavaScript, for themes.php.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user