| 1 | Index: wp-admin/includes/theme.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/includes/theme.php (revision 18407) |
|---|
| 4 | +++ wp-admin/includes/theme.php (working copy) |
|---|
| 5 | @@ -87,13 +87,20 @@ |
|---|
| 6 | if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() ) |
|---|
| 7 | return new WP_Error('fs_error', __('Filesystem error.'), $wp_filesystem->errors); |
|---|
| 8 | |
|---|
| 9 | - //Get the base plugin folder |
|---|
| 10 | + //Get the base theme folder |
|---|
| 11 | $themes_dir = $wp_filesystem->wp_themes_dir(); |
|---|
| 12 | if ( empty($themes_dir) ) |
|---|
| 13 | return new WP_Error('fs_no_themes_dir', __('Unable to locate WordPress theme directory.')); |
|---|
| 14 | |
|---|
| 15 | $themes_dir = trailingslashit( $themes_dir ); |
|---|
| 16 | $theme_dir = trailingslashit($themes_dir . $template); |
|---|
| 17 | + |
|---|
| 18 | + if ( file_exists( $theme_dir . '/uninstall.php' ) ) { |
|---|
| 19 | + define( 'WP_UNINSTALL_THEME', true ); |
|---|
| 20 | + include( $theme_dir . '/uninstall.php' ); |
|---|
| 21 | + } |
|---|
| 22 | + do_action( 'uninstall_theme', $theme_dir ); |
|---|
| 23 | + |
|---|
| 24 | $deleted = $wp_filesystem->delete($theme_dir, true); |
|---|
| 25 | |
|---|
| 26 | if ( ! $deleted ) |
|---|