[resolved] register_activation_hook on multisite (4 posts)

  1. Ollie Armstrong
    Posted 4 years ago #

    Tried looking through at other threads but couldn't find any help on this.

    I am developing a plugin that uses register_activation_hook and I have run into a few issues using it on multisite.

    The install function that r_a_h calls is only run when network activated. I am looking for a way to get this to run when it is just activated on one site.

    Failing this is there a way for me to check inside my install function whether it has been network activated so I can build into the script the correct database writes?


  2. is_multisite is the check I think.

  3. It is. I use this to kick people out of Multisite on a plugin:

    $exit_msg_ms  = 'Sorry, but this plugin is not supported (and will not work) on WordPress MultiSite.';
    if( is_multisite() ) { exit($exit_msg_ms); }

    and this to handle the dif betwee things:

    if ( is_multisite() ) {
            // Adding in filters for Multi Site installs
    } else {
            // Adding in filters for Single Site installs
  4. Ollie Armstrong
    Posted 4 years ago #

    Cheers guys, don't know how I couldn't find that.

Topic Closed

This topic has been closed to new replies.

About this Topic