Skip to content

Instantly share code, notes, and snippets.

@jason-cleaveland
Last active April 26, 2021 05:12
Show Gist options
  • Save jason-cleaveland/3c31646ee22b266628d81d5176c6ba16 to your computer and use it in GitHub Desktop.
Save jason-cleaveland/3c31646ee22b266628d81d5176c6ba16 to your computer and use it in GitHub Desktop.
Public Code Contributions
<?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();
}
@EdwardBock
Copy link

Thanks for the suggestion. It's now build in the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment