From 85b3d7821e8a5e4151b35abad97159b50ef320a6 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 6 Oct 2004 06:20:52 +0000 Subject: [PATCH] Add switch_theme action. Cleanup staticize-reloaded's cache when theme is switched. git-svn-id: https://develop.svn.wordpress.org/trunk@1755 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/admin-functions.php | 2 ++ wp-admin/themes.php | 2 ++ wp-content/plugins/staticize-reloaded.php | 1 + 3 files changed, 5 insertions(+) diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 0b700b46e6..2b3a76f724 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -743,12 +743,14 @@ function validate_current_theme() { if (($template != 'default') && (! file_exists("$theme_root/$template/index.php"))) { update_option('template', 'default'); update_option('stylesheet', 'default'); + do_action('switch_theme', 'Default'); return false; } if (($stylesheet != 'default') && (! file_exists("$theme_root/$stylesheet/style.css"))) { update_option('template', 'default'); update_option('stylesheet', 'default'); + do_action('switch_theme', 'Default'); return false; } diff --git a/wp-admin/themes.php b/wp-admin/themes.php index b4b61a88e8..ec605fa5d4 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -15,6 +15,8 @@ if ( isset($_GET['action']) ) { update_option('stylesheet', $_GET['stylesheet']); } + do_action('switch_theme', get_current_theme()); + header('Location: themes.php?activated=true'); } } diff --git a/wp-content/plugins/staticize-reloaded.php b/wp-content/plugins/staticize-reloaded.php index 5ba9eb005b..f875d456aa 100644 --- a/wp-content/plugins/staticize-reloaded.php +++ b/wp-content/plugins/staticize-reloaded.php @@ -153,6 +153,7 @@ if(function_exists('add_action')) { add_action('edit_comment', 'postChange', 0); add_action('delete_comment', 'postChange', 0); add_action('template_save', 'postChange', 0); + add_action('switch_theme', 'postChange', 0); } if ( isset($_GET['staticize-flush']) ) {