WordPress.org

Support

Support » Multisite » [Resolved] register_activation_hook on multisite

[Resolved] register_activation_hook on multisite

  • 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?

    Cheers,
    Ollie

Viewing 3 replies - 1 through 3 (of 3 total)
  • is_multisite is the check I think.

    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
    }

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] register_activation_hook on multisite’ is closed to new replies.