[wp-hackers] changing a theme via wpdb class

Chris McCoy chris at lod.com
Sun Apr 29 17:59:57 UTC 2012


function change_theme_manually() {
        global $wpdb;
        $newtheme = 'twentyeleven';
        $wpdb->update($wpdb->options,
                array('template'=> $newtheme),
                array('stylesheet'=> $newtheme),
                array('current_theme' => $newtheme)
        );
}


add_action('init','change_theme_manually');

can someone tell me what is wrong with this?

Doesn't seem to update the options





More information about the wp-hackers mailing list