Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- register_activation_hook( __FILE__ 'my_plugin_activation' );
- function my_plugin_activation( $network_wide = false ) {
- global $wpdb;
- if ( $network_wide ) {
- $blogids = $wpdb->get_col($wpdb->prepare("
- SELECT blog_id
- FROM $wpdb->blogs
- WHERE site_id = %d
- AND deleted = 0
- AND spam = 0
- ", $wpdb->siteid));
- foreach ($blogids as $blog_id) {
- switch_to_blog($blog_id);
- my_plugin_install();
- }
- restore_current_blog();
- } else {
- my_plugin_install();
- }
- }
- function my_plugin_install() {
- /* Setup your tables here */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement