Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I know that plugins can deactivate itself, but how about themes?

I work on a parent theme (Framework) and I don't want users to be able to activate it.

This is what I have so far. The problem is that there is a message coming up from wordpress that the theme is demaged when I do this this way. It shows the last theme there one time but then swiches again to the default theme because wordpress expect the theme I clicked activate for. I need to bypass this somehow. I want to show my own message instead. Any ideas?

Although I don't know if its right to set all to one value, isn't template supposed to be the parent themes name when there is one? Or does WP figure this out automatically?

add_action( 'after_switch_theme', 'switch_to_last_theme' );

function switch_to_last_theme( $old_theme ){

    echo "<br><br><h1>just for testing last theme: $old_theme</h1>";

    update_option('template', $old_theme);
    update_option('stylesheet', $old_theme);
    update_option('current_theme', $old_theme);

}
share|improve this question
add comment

1 Answer

There's the check_theme_switched() function.

Checks if a theme has been changed and runs ‘after_switch_theme’ hook on the next WP load

Note: The action has one argument, named $old_theme that you can access. After running the filter, the option theme_switched gets set to true.

share|improve this answer
    
well I am still not sure what to do with it exactly to get to my goal. –  amy May 8 '12 at 11:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.