Last active
April 26, 2021 05:12
-
-
Save jason-cleaveland/3c31646ee22b266628d81d5176c6ba16 to your computer and use it in GitHub Desktop.
Public Code Contributions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* on activation | |
*/ | |
function on_activate( $networkwide ) { | |
// check if this is a multisite installation | |
if( function_exists('is_multisite') && is_multisite() ) { | |
// check if it is a network activation | |
if( $networkwide ) { | |
$network_site = get_network()->site_id; | |
$args = array( 'fields' => 'ids' ); | |
$site_ids = get_sites( $args ); | |
// run the activation function for each blog id | |
foreach ( $site_ids as $site_id ) { | |
switch_to_blog( $site_id ); | |
$this->log->createTable(); | |
} | |
// switch back to the network site | |
switch_to_blog( $network_site ); | |
return; | |
} | |
} | |
// not multisite or a network activation - run as ususal | |
$this->log->createTable(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the suggestion. It's now build in the plugin.