OSDN Git Service

don't allow deletion of the current theme
authorscribu <mail@scribu.net>
Fri, 8 Mar 2013 20:44:29 +0000 (22:44 +0200)
committerscribu <mail@scribu.net>
Fri, 8 Mar 2013 20:44:32 +0000 (22:44 +0200)
WSODs are bad, mkay.

php/commands/theme.php

index 26dbdad..4f5a8de 100644 (file)
@@ -178,6 +178,10 @@ class Theme_Command extends \WP_CLI\CommandWithUpgrade {
        function delete( $args ) {
                $theme = $this->parse_name( $args );
 
+               if ( $this->is_active_theme( $theme ) ) {
+                       WP_CLI::error( "Can't delete the currently active theme." );
+               }
+
                $r = delete_theme( $theme->get_stylesheet() );
 
                if ( is_wp_error( $r ) ) {