The MU forums have moved to

Determine if running on WPMU? (5 posts)

  1. Enric
    Posted 17 years ago #

    Is there a WP function to call from which the plugin can determine if it's running on WP or WPMU? I have a plugin (vPIP) that works on both platforms. But the installation directories are different

    WP: ../wp-content/plugins/vPIP/
    WPMU: /wp-content/mu-plugins/vPIP/

    So the plugin needs to determine on which WP platform it's running.



  2. lunabyte
    Posted 17 years ago #

    Um, why would this plugin be relevant in the mu-plugins directory?
    Seems it wouldn't be something that needs to be enabled for every single user all the time?

    Also, a plugin in a subdir of mu-plugins won't work anyway. The main plugin file has to be located in mu-plugins or it won't be included.

    The mu-plugins directory is really only for things that must be loaded for every pageview, on every account, regardless of what the user wants.

    With a plugin of this nature, I don't see it as something the 99% of the people using it would want it run for every user. Better off to keep it in the plugins directory (which works as you would expect) for MU as well.

    For the few folks that would want it in the mu-plugins directory, they most likely already would know to edit the file.

  3. Enric
    Posted 17 years ago #

    Yes, the plugin is in the main mu-plugins directory and then points to it's subdirectory for supplementary files.

    You have a good point about the user editing when placed in mu-plugins. The plugin allows the user to put in the directory for the plugin in it's options menu anyways.


  4. lunabyte
    Posted 17 years ago #

    I see. Well, could be worse then.

    Checking for MU is easy though.

    if ( function_exists('is_site_admin() ) { this...
    } else {
    ... do this instead ...

    Although if you're allowing them to specify the directory in the settings, it's probably redundant.

  5. Enric
    Posted 17 years ago #

    Thanks. It may be useful at some point for the plugin to know whether it's in WP or WPMU.

About this Topic