Codex tools: Log in
Contents |
The action load-themes.php is triggered when the theme option page is shown. It executes only when the theme that contain the action (in function.php) selected.
You can use it to execute something when your theme is activate or deactivate.
<?php add_action('load-themes.php', 'on_change_theme_function'); ?>
add_action( 'load-themes.php', 'Init_theme' );
function Init_theme(){
global $pagenow;
if ( 'themes.php' == $pagenow && isset( $_GET['activated'] ) ){ // Test if theme is activate
// What to do when theme is activate
}
}