Title: Activation code not running for default theme
Last modified: August 21, 2016

---

# Activation code not running for default theme

 *  [Josh](https://wordpress.org/support/users/jjkiesch/)
 * (@jjkiesch)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/activation-code-not-running-for-default-theme/)
 * I am running a network site and have the default theme set in my wp-config file
   like this:
 * `define( 'WP_DEFAULT_THEME', 'mythemefolder' );`
 * I have some code in the functions.php file that sets up a new role for this theme
   and am running in the **after_switch_theme** action. My problem is that my code
   only runs if I activate another theme and then switch back to this one.
 * What hook should we use to have code only run once when a theme is first used
   even when it’s set as the default theme? From what I’ve read, **after_setup_theme**
   runs on every page load.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/activation-code-not-running-for-default-theme/#post-3739163)
 * Perhaps ‘wpmu_new_blog’ would meet your needs?
 *  Thread Starter [Josh](https://wordpress.org/support/users/jjkiesch/)
 * (@jjkiesch)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/activation-code-not-running-for-default-theme/#post-3739170)
 * I stumbled on that earlier. I tried it in my theme and it appears that the action
   doesn’t run in the functions.php of the theme. I’m extracting my functionality
   into a plugin to see if I can use wpmu_new_blog there. If it works, I’ll post
   my findings back here.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Activation code not running for default theme’ is closed to new replies.

## Tags

 * [after_setup_theme](https://wordpress.org/support/topic-tag/after_setup_theme/)
 * [multisite](https://wordpress.org/support/topic-tag/multisite/)
 * [network](https://wordpress.org/support/topic-tag/network/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [Josh](https://wordpress.org/support/users/jjkiesch/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/activation-code-not-running-for-default-theme/#post-3739170)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
