after_setup_theme always runs

SOLUTION: after_switch_theme does exactly what I intended here. It fires after the theme is switched TO your theme. One of the solutions mentioned below uses switch_theme. This does not have the desired results, since it only happens upon switching away from your theme.

Here is an article that I found as reference: http://core.trac.wordpress.org/ticket/7795#comment:29

Here is my modified code

add_action( 'after_switch_theme', 'fwp_theme_setup' );
function fwp_theme_setup(){ 
    require_once($_SERVER['DOCUMENT_ROOT'].'/wp-admin/includes/plugin.php');
    activate_plugin('enable-media-replace/enable-media-replace.php');
    activate_plugin('seo-image/seo-friendly-images.php');
    activate_plugin('w3-total-cache/w3-total-cache.php');
}

Leave a Comment