[wp-hackers] changing a theme via wpdb class

John Blackbourn johnbillion+wp at gmail.com
Sun Apr 29 19:09:28 UTC 2012


On 29 April 2012 19:05, William P. Davis <will.davis at gmail.com> wrote:
> You wouldn't want to do this on init - it will run those queries on every page load, which is massively inefficient. And you wouldn't use $wpdb's update wrapper to change the options table, you want the update_option function.
>
> If you want to change themes, I would recommend the switch_theme function: http://codex.wordpress.org/Function_Reference/switch_theme
>
> I'm not sure how you're triggering this, but you only want to do it once (such as on plugin activation)

And another method is to add a filter to 'stylesheet' and 'template'
which will filter the theme at runtime without changing anything in
the database.


More information about the wp-hackers mailing list