WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know the many tricks to see if said theme is activated, I have scoured the internet. I am not looking for re-pasting of that code. What I am looking for though is weather or not 3.3-3.5 released a new function that does something upon theme_init, I saw some sort of hook, but I can't remember where, in the codex, dealing with doing things after a theme has been initialized..

Any one know?

share|improve this question
up vote 1 down vote accepted

You might be looking for the after_setup_theme hook:


share|improve this answer
can I use this same function to do something after deactivation? The example seems to say so but im curious – Kyle Adams Feb 16 '13 at 17:11
you can play with $_GET['previewed'] and $_GET['theme'] – birgire Feb 16 '13 at 17:20
-1 as this hook is fired at each WP init. It is fired after including the functions.php file of the theme, therefor it is not an "activation" hook. – Mark Kaplun Feb 16 '13 at 17:20
yes true, but the fix for that is mentioned on the Codex page, to check for the above GET parameters or $_GET['activated'] – birgire Feb 16 '13 at 17:23

For anyone stumbling upon this question; there is an action you can hook into (added 3.3.0) which is fired only on activation of a new theme: after_switch_theme

add_action('after_switch_theme', 'mytheme_setup_options');

function mytheme_setup_options () {
  //doing a thing...


To do something on deactivation of a theme you can use the sister action: switch_theme

share|improve this answer

With the theme preview features it is unlikely that there will ever be a theme activation hook since themes need to work even without being "activated".

share|improve this answer

Your Answer


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.