Support » Plugins » Hacks » 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


    Perhaps ‘wpmu_new_blog’ would meet your needs?

    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.