Created
October 23, 2015 18:42
-
-
Save denisstoyanov/9cb9c60af1ba204e2208 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Deletes all themes except the active one | |
function delete_not_active_themes() { | |
if (!function_exists('delete_theme')) { | |
require_once(ABSPATH . WPINC . '/pluggable.php'); | |
require_once(ABSPATH . 'wp-admin/includes/file.php'); | |
require_once(ABSPATH . 'wp-admin/includes/theme.php'); | |
} | |
$themes = wp_get_themes(); | |
$current_theme = wp_get_theme(); | |
foreach ($themes as $theme) { | |
if ($current_theme->get_stylesheet() !== $theme->get_stylesheet()) { | |
delete_theme($theme->get_stylesheet()); | |
} | |
} | |
} | |
delete_not_active_themes(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment